Bug 1472776: add a 'cancel' action to cancel one task; r=tomprince
authorDustin J. Mitchell <dustin@mozilla.com>
Wed, 27 Jun 2018 15:01:40 +0000
changeset 424969 0ee86e6918708e0bcaf3c7abe5eec63425923b7b
parent 424968 e7bd17818f9d872c42afb26ea8c9a4e5b48592db
child 424970 0d61bbcd24d8eb49d2beea278859da868186f783
push id104946
push userrgurzau@mozilla.com
push dateWed, 04 Jul 2018 10:03:16 +0000
treeherdermozilla-inbound@796893f4d2f5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstomprince
bugs1472776
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1472776: add a 'cancel' action to cancel one task; r=tomprince MozReview-Commit-ID: E3MTcM4TR7e
taskcluster/taskgraph/actions/cancel.py
new file mode 100644
--- /dev/null
+++ b/taskcluster/taskgraph/actions/cancel.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+from taskgraph.util.taskcluster import cancel_task
+from .registry import register_callback_action
+
+
+@register_callback_action(
+    title='Cancel Task',
+    name='cancel',
+    symbol='cx',
+    kind='hook',
+    generic=True,
+    description=(
+        'Cancel the given task'
+    ),
+    order=100,
+    context=[{}]
+)
+def cancel_action(parameters, graph_config, input, task_group_id, task_id, task):
+    # Note that this is limited by the scopes afforded to generic actions to
+    # only cancel tasks with the level-specific schedulerId.
+    cancel_task(task_id, use_proxy=True)