def show_taskgraph(self, graph_attr, options): import taskgraph.parameters import taskgraph.target_tasks import taskgraph.generator import taskgraph if options['fast']: taskgraph.fast = True 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) tg = getattr(tgg, graph_attr) show_method = getattr( self, 'show_taskgraph_' + (options['format'] or 'labels')) tg = self.get_filtered_taskgraph(tg, options["tasks_regex"]) show_method(tg) except Exception: traceback.print_exc() sys.exit(1)
def show_taskgraph(self, graph_attr, options): import taskgraph.parameters import taskgraph.target_tasks import taskgraph.generator try: self.setup_logging(quiet=options['quiet'], verbose=options['verbose']) parameters = taskgraph.parameters.load_parameters_file(options) parameters.check() target_tasks_method = parameters.get('target_tasks_method', 'all_tasks') target_tasks_method = taskgraph.target_tasks.get_method( target_tasks_method) tgg = taskgraph.generator.TaskGraphGenerator( root_dir=options['root'], parameters=parameters, target_tasks_method=target_tasks_method) tg = getattr(tgg, graph_attr) show_method = getattr( self, 'show_taskgraph_' + (options['format'] or 'labels')) show_method(tg) except Exception: traceback.print_exc() sys.exit(1)
def show_taskgraph(self, graph_attr, options): import taskgraph.parameters import taskgraph.target_tasks import taskgraph.generator try: self.setup_logging(quiet=options['quiet'], verbose=options['verbose']) parameters = taskgraph.parameters.load_parameters_file(options) parameters.check() target_tasks_method = parameters.get('target_tasks_method', 'all_tasks') target_tasks_method = taskgraph.target_tasks.get_method(target_tasks_method) tgg = taskgraph.generator.TaskGraphGenerator( root_dir=options['root'], parameters=parameters, target_tasks_method=target_tasks_method) tg = getattr(tgg, graph_attr) show_method = getattr(self, 'show_taskgraph_' + (options['format'] or 'labels')) tg = self.get_filtered_taskgraph(tg, options["tasks_regex"]) show_method(tg) except Exception: traceback.print_exc() sys.exit(1)
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)
def test_action_callback(self, **options): import taskgraph.parameters from taskgraph.util.taskcluster import get_task_definition import taskgraph.actions import yaml def load_data(filename): with open(filename) as f: if filename.endswith('.yml'): return yaml.safe_load(f) elif filename.endswith('.json'): return json.load(f) else: raise Exception("unknown filename {}".format(filename)) try: self.setup_logging() task_id = options['task_id'] if options['task']: task = load_data(options['task']) elif task_id: task = get_task_definition(task_id) else: task = None if options['input']: input = load_data(options['input']) else: input = None parameters = taskgraph.parameters.load_parameters_file( options['parameters']) parameters.check() root = options['root'] return taskgraph.actions.trigger_action_callback( task_group_id=options['task_group_id'], task_id=task_id, task=task, input=input, callback=options['callback'], parameters=parameters, root=root, test=True) except Exception: traceback.print_exc() sys.exit(1)
def test_action_callback(self, **options): import taskgraph.parameters import taskgraph.actions from taskgraph.util import yaml def load_data(filename): with open(filename) as f: if filename.endswith(".yml"): return yaml.load_stream(f) elif filename.endswith(".json"): return json.load(f) else: raise Exception("unknown filename {}".format(filename)) try: self.setup_logging() task_id = options["task_id"] if options["input"]: input = load_data(options["input"]) else: input = None parameters = taskgraph.parameters.load_parameters_file( options["parameters"], strict=False, # FIXME: There should be a way to parameterize this. trust_domain="gecko", ) parameters.check() root = options["root"] return taskgraph.actions.trigger_action_callback( task_group_id=options["task_group_id"], task_id=task_id, input=input, callback=options["callback"], parameters=parameters, root=root, test=True, ) except Exception: traceback.print_exc() sys.exit(1)
def test_action_callback(options): import taskgraph.parameters import taskgraph.actions from taskgraph.util import yaml from taskgraph.config import load_graph_config def load_data(filename): with open(filename) as f: if filename.endswith(".yml"): return yaml.load_stream(f) elif filename.endswith(".json"): return json.load(f) else: raise Exception(f"unknown filename {filename}") try: task_id = options["task_id"] if options["input"]: input = load_data(options["input"]) else: input = None root = options["root"] graph_config = load_graph_config(root) trust_domain = graph_config["trust-domain"] graph_config.register() parameters = taskgraph.parameters.load_parameters_file( options["parameters"], strict=False, trust_domain=trust_domain) parameters.check() return taskgraph.actions.trigger_action_callback( task_group_id=options["task_group_id"], task_id=task_id, input=input, callback=options["callback"], parameters=parameters, root=root, test=True, ) except Exception: traceback.print_exc() sys.exit(1)
def test_action_callback(self, **options): import taskgraph.parameters from taskgraph.util.taskcluster import get_task_definition import taskgraph.actions import yaml def load_data(filename): with open(filename) as f: if filename.endswith('.yml'): return yaml.safe_load(f) elif filename.endswith('.json'): return json.load(f) else: raise Exception("unknown filename {}".format(filename)) try: self.setup_logging() task_id = options['task_id'] if options['task']: task = load_data(options['task']) elif task_id: task = get_task_definition(task_id) else: task = None if options['input']: input = load_data(options['input']) else: input = None parameters = taskgraph.parameters.load_parameters_file(options['parameters']) parameters.check() return taskgraph.actions.trigger_action_callback( task_group_id=options['task_group_id'], task_id=task_id, task=task, input=input, callback=options['callback'], parameters=parameters, test=True) except Exception: traceback.print_exc() sys.exit(1)