Bug 1514087: [taskgraph] Add an option to not optimize target tasks in cron graphs; r=dustin

This allows the target tasks to include cached tasks, which by default, get
optimized out of the graph on on-`try` branches.

Differential Revision: https://phabricator.services.mozilla.com/D15278

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Prince 2018-12-26 14:43:34 +00:00
parent eb86fefb02
commit bce106f4b1
5 changed files with 23 additions and 1 deletions

View File

@ -104,6 +104,7 @@ jobs:
type: decision-task
treeherder-symbol: customv8
target-tasks-method: customv8_update
optimize-target-tasks: false
run-on-projects:
- mozilla-central
when:

View File

@ -13,6 +13,7 @@ import os
import sys
import traceback
import re
from distutils.util import strtobool
from mach.decorators import (
CommandArgument,
@ -171,6 +172,12 @@ class MachCommands(MachCommandBase):
help='SCM level of this repository')
@CommandArgument('--target-tasks-method',
help='method for selecting the target tasks to generate')
@CommandArgument('--optimize-target-tasks',
type=strtobool,
nargs='?', const='true',
help='If specified, this indicates whether the target '
'tasks are eligible for optimization. Otherwise, '
'the default for the project is used.')
@CommandArgument('--try-task-config-file',
help='path to try task configuration file')
def taskgraph_decision(self, **options):

View File

@ -21,6 +21,10 @@ def run_decision_task(job, params, root):
arguments = []
if 'target-tasks-method' in job:
arguments.append('--target-tasks-method={}'.format(job['target-tasks-method']))
if job.get('optimize-target-tasks') is not None:
arguments.append('--optimize-target-tasks={}'.format(
str(job['optimize-target-tasks']).lower(),
))
return [
make_decision_task(
params,

View File

@ -7,7 +7,7 @@
from __future__ import absolute_import, print_function, unicode_literals
from voluptuous import Any, Required, All
from voluptuous import Any, Required, All, Optional
from taskgraph.util.schema import (
optionally_keyed_by,
validate_schema,
@ -36,6 +36,13 @@ cron_yml_schema = Schema({
# --target-tasks-method './mach taskgraph decision' argument
'target-tasks-method': basestring,
Optional(
'optimize-target-tasks',
description='If specified, this indicates whether the target '
'tasks are eligible for optimization. Otherwise, '
'the default for the project is used.',
): bool,
},
# when to run it

View File

@ -286,6 +286,9 @@ def get_decision_parameters(config, options):
if 'try' in project:
set_try_config(parameters, task_config_file)
if options.get('optimize_target_tasks') is not None:
parameters['optimize_target_tasks'] = options['optimize_target_tasks']
result = Parameters(**parameters)
result.check()
return result