taskgraph.actions package

Submodules

taskgraph.actions.add_new_jobs module

taskgraph.actions.add_talos module

taskgraph.actions.backfill module

taskgraph.actions.cancel_all module

taskgraph.actions.cancel_all.list_group(task_group_id, session)

taskgraph.actions.mochitest_retrigger module

taskgraph.actions.purge_caches module

taskgraph.actions.registry module

class taskgraph.actions.registry.Action(name, title, description, order, context, schema, task_template_builder)

Bases: tuple

context

Alias for field number 4

description

Alias for field number 2

name

Alias for field number 0

order

Alias for field number 3

schema

Alias for field number 5

task_template_builder

Alias for field number 6

title

Alias for field number 1

taskgraph.actions.registry.get_actions()
taskgraph.actions.registry.get_callbacks()
taskgraph.actions.registry.is_json(data)

Return True, if data is a JSON serializable data structure.

taskgraph.actions.registry.register_callback_action(name, title, symbol, description, order=10000, context=[], available=<function <lambda>>, schema=None)

Register an action callback that can be triggered from supporting user interfaces, such as Treeherder.

This function is to be used as a decorator for a callback that takes parameters as follows:

parameters:
Decision task parameters, see taskgraph.parameters.Parameters.
input:
Input matching specified JSON schema, None if no schema parameter is given to register_callback_action.
task_group_id:
The id of the task-group this was triggered for.
task_id and task`:
task identifier and task definition for task the action was triggered for, None if no context parameters was given to register_callback_action.
Parameters:
  • name (str) – An identifier for this action, used by UIs to find the action.
  • title (str) – A human readable title for the action to be used as label on a button or text on a link for triggering the action.
  • symbol (str) – Treeherder symbol for the action callback, this is the symbol that the task calling your callback will be displayed as. This is usually 1-3 letters abbreviating the action title.
  • description (str) – A human readable description of the action in markdown. This will be display as tooltip and in dialog window when the action is triggered. This is a good place to describe how to use the action.
  • order (int) – Order of the action in menus, this is relative to the order of other actions declared.
  • context (list of dict) –

    List of tag-sets specifying which tasks the action is can take as input. If no tag-sets is specified as input the action is related to the entire task-group, and won’t be triggered with a given task.

    Otherwise, if context = [{'k': 'b', 'p': 'l'}, {'k': 't'}] will only be displayed in the context menu for tasks that has task.tags.k == 'b' && task.tags.p = 'l' or task.tags.k = 't'. Esentially, this allows filtering on task.tags.

  • available (function) – An optional function that given decision parameters decides if the action is available. Defaults to a function that always returns True.
  • schema (dict) – JSON schema specifying input accepted by the action. This is optional and can be left null if no input is taken.
Returns:

To be used as decorator for the callback function.

Return type:

function

taskgraph.actions.registry.register_task_action(name, title, description, order, context, schema=None)

Register an action task that can be triggered from supporting user interfaces, such as Treeherder.

Most actions will create intermediate action tasks that call back into in-tree python code. To write such an action please use register_callback_action().

This function is to be used a decorator for a function that returns a task template, see specification for details on the templating features. The decorated function will be given decision task parameters, which can be embedded in the task template that is returned.

Parameters:
  • name (str) – An identifier for this action, used by UIs to find the action.
  • title (str) – A human readable title for the action to be used as label on a button or text on a link for triggering the action.
  • description (str) – A human readable description of the action in markdown. This will be display as tooltip and in dialog window when the action is triggered. This is a good place to describe how to use the action.
  • order (int) – Order of the action in menus, this is relative to the order of other actions declared.
  • context (list of dict) –

    List of tag-sets specifying which tasks the action is can take as input. If no tag-sets is specified as input the action is related to the entire task-group, and won’t be triggered with a given task.

    Otherwise, if context = [{'k': 'b', 'p': 'l'}, {'k': 't'}] will only be displayed in the context menu for tasks that has task.tags.k == 'b' && task.tags.p = 'l' or task.tags.k = 't'. Esentially, this allows filtering on task.tags.

  • schema (dict) – JSON schema specifying input accepted by the action. This is optional and can be left null if no input is taken.
Returns:

To be used as decorator for the function that builds the task template. The decorated function will be given decision parameters and may return None instead of a task template, if the action is disabled.

Return type:

function

taskgraph.actions.registry.render_actions_json(parameters)

Render JSON object for the public/actions.json artifact.

Parameters:parameters (taskgraph.parameters.Parameters) – Decision task parameters.
Returns:JSON object representation of the public/actions.json artifact.
Return type:dict
taskgraph.actions.registry.trigger_action_callback(task_group_id, task_id, task, input, callback, parameters, test=False)

Trigger action callback with the given inputs. If test is true, then run the action callback in testing mode, without actually creating tasks.

taskgraph.actions.release_promotion module

taskgraph.actions.release_promotion.is_release_promotion_available(parameters)

taskgraph.actions.retrigger module

taskgraph.actions.run_missing_tests module

taskgraph.actions.util module

taskgraph.actions.util.create_task_from_def(task_id, task_def, level)

Create a new task from a definition rather than from a label that is already in the full-task-graph. The task definition will have {relative-datestamp’: ‘..’} rendered just like in a decision task. Use this for entirely new tasks or ones that change internals of the task. It is useful if you want to “edit” the full_task_graph and then hand it to this function. No dependencies will be scheduled. You must handle this yourself. Seeing how create_tasks handles it might prove helpful.

taskgraph.actions.util.create_tasks(to_run, full_task_graph, label_to_taskid, params, decision_task_id=None)

Create new tasks. The task definition will have {relative-datestamp’: ‘..’} rendered just like in a decision task. Action callbacks should use this function to create new tasks, allowing easy debugging with mach taskgraph action-callback –test. This builds up all required tasks to run in order to run the tasks requested.

If you wish to create the tasks in a new group, leave out decision_task_id.

taskgraph.actions.util.fetch_graph_and_labels(parameters)
taskgraph.actions.util.find_decision_task(parameters)

Given the parameters for this action, find the taskId of the decision task

taskgraph.actions.util.find_existing_tasks_from_previous_kinds(full_task_graph, previous_graph_ids, rebuild_kinds)

Given a list of previous decision/action taskIds and kinds to ignore from the previous graphs, return a dictionary of labels-to-taskids to use as existing_tasks in the optimization step.

taskgraph.actions.util.find_hg_revision_pushlog_id(parameters, revision)

Given the parameters for this action and a revision, find the pushlog_id of the revision.

taskgraph.actions.util.update_parent(task, graph)

Module contents

taskgraph.actions.register_task_action(name, title, description, order, context, schema=None)

Register an action task that can be triggered from supporting user interfaces, such as Treeherder.

Most actions will create intermediate action tasks that call back into in-tree python code. To write such an action please use register_callback_action().

This function is to be used a decorator for a function that returns a task template, see specification for details on the templating features. The decorated function will be given decision task parameters, which can be embedded in the task template that is returned.

Parameters:
  • name (str) – An identifier for this action, used by UIs to find the action.
  • title (str) – A human readable title for the action to be used as label on a button or text on a link for triggering the action.
  • description (str) – A human readable description of the action in markdown. This will be display as tooltip and in dialog window when the action is triggered. This is a good place to describe how to use the action.
  • order (int) – Order of the action in menus, this is relative to the order of other actions declared.
  • context (list of dict) –

    List of tag-sets specifying which tasks the action is can take as input. If no tag-sets is specified as input the action is related to the entire task-group, and won’t be triggered with a given task.

    Otherwise, if context = [{'k': 'b', 'p': 'l'}, {'k': 't'}] will only be displayed in the context menu for tasks that has task.tags.k == 'b' && task.tags.p = 'l' or task.tags.k = 't'. Esentially, this allows filtering on task.tags.

  • schema (dict) – JSON schema specifying input accepted by the action. This is optional and can be left null if no input is taken.
Returns:

To be used as decorator for the function that builds the task template. The decorated function will be given decision parameters and may return None instead of a task template, if the action is disabled.

Return type:

function

taskgraph.actions.register_callback_action(name, title, symbol, description, order=10000, context=[], available=<function <lambda>>, schema=None)

Register an action callback that can be triggered from supporting user interfaces, such as Treeherder.

This function is to be used as a decorator for a callback that takes parameters as follows:

parameters:
Decision task parameters, see taskgraph.parameters.Parameters.
input:
Input matching specified JSON schema, None if no schema parameter is given to register_callback_action.
task_group_id:
The id of the task-group this was triggered for.
task_id and task`:
task identifier and task definition for task the action was triggered for, None if no context parameters was given to register_callback_action.
Parameters:
  • name (str) – An identifier for this action, used by UIs to find the action.
  • title (str) – A human readable title for the action to be used as label on a button or text on a link for triggering the action.
  • symbol (str) – Treeherder symbol for the action callback, this is the symbol that the task calling your callback will be displayed as. This is usually 1-3 letters abbreviating the action title.
  • description (str) – A human readable description of the action in markdown. This will be display as tooltip and in dialog window when the action is triggered. This is a good place to describe how to use the action.
  • order (int) – Order of the action in menus, this is relative to the order of other actions declared.
  • context (list of dict) –

    List of tag-sets specifying which tasks the action is can take as input. If no tag-sets is specified as input the action is related to the entire task-group, and won’t be triggered with a given task.

    Otherwise, if context = [{'k': 'b', 'p': 'l'}, {'k': 't'}] will only be displayed in the context menu for tasks that has task.tags.k == 'b' && task.tags.p = 'l' or task.tags.k = 't'. Esentially, this allows filtering on task.tags.

  • available (function) – An optional function that given decision parameters decides if the action is available. Defaults to a function that always returns True.
  • schema (dict) – JSON schema specifying input accepted by the action. This is optional and can be left null if no input is taken.
Returns:

To be used as decorator for the callback function.

Return type:

function

taskgraph.actions.render_actions_json(parameters)

Render JSON object for the public/actions.json artifact.

Parameters:parameters (taskgraph.parameters.Parameters) – Decision task parameters.
Returns:JSON object representation of the public/actions.json artifact.
Return type:dict
taskgraph.actions.trigger_action_callback(task_group_id, task_id, task, input, callback, parameters, test=False)

Trigger action callback with the given inputs. If test is true, then run the action callback in testing mode, without actually creating tasks.