Bug 1415868 - add 'mach taskgraph actions'; r=jonasfj,tomprince

MozReview-Commit-ID: ExVRgcD02GK
This commit is contained in:
Dustin J. Mitchell
2018-04-23 21:14:14 +00:00
parent 20930982e5
commit b17138b7da
2 changed files with 41 additions and 0 deletions

View File

@@ -103,6 +103,20 @@ class MachCommands(MachCommandBase):
def taskgraph_morphed(self, **options):
return self.show_taskgraph('morphed_task_graph', options)
@SubCommand('taskgraph', 'actions',
description="Write actions.json to stdout")
@CommandArgument('--root', '-r',
help="root of the taskgraph definition relative to topsrcdir")
@CommandArgument('--quiet', '-q', action="store_true",
help="suppress all logging output")
@CommandArgument('--verbose', '-v', action="store_true",
help="include debug-level logging output")
@CommandArgument('--parameters', '-p', default="project=mozilla-central",
help="parameters file (.yml or .json; see "
"`taskcluster/docs/parameters.rst`)`")
def taskgraph_actions(self, **options):
return self.show_actions(options)
@SubCommand('taskgraph', 'decision',
description="Run the decision task")
@CommandArgument('--root', '-r',
@@ -385,6 +399,28 @@ class MachCommands(MachCommandBase):
filtered_taskgraph = TaskGraph(filteredtasks, Graph(set(filteredtasks), filterededges))
return filtered_taskgraph
def show_actions(self, options):
import taskgraph.parameters
import taskgraph.target_tasks
import taskgraph.generator
import taskgraph
import taskgraph.actions
try:
self.setup_logging(quiet=options['quiet'], verbose=options['verbose'])
parameters = taskgraph.parameters.load_parameters_file(options['parameters'])
parameters.check()
tgg = taskgraph.generator.TaskGraphGenerator(
root_dir=options.get('root'),
parameters=parameters)
actions = taskgraph.actions.render_actions_json(parameters, tgg.graph_config)
print(json.dumps(actions, sort_keys=True, indent=2, separators=(',', ': ')))
except Exception:
traceback.print_exc()
sys.exit(1)
@CommandProvider
class TaskClusterImagesProvider(MachCommandBase):