Bug 1383880: add only-if-dependencies-run optimization for follow-ons; r=ahal

MozReview-Commit-ID: JuhwyQIx3Mh

--HG--
extra : rebase_source : 553eabc3ac408710bd8c0124232985cc4b01e705
extra : source : 4b3fa9587e88431cc28331d129dd7ef4d1a793c2
This commit is contained in:
Dustin J. Mitchell 2017-08-25 21:18:13 +00:00
Родитель 34ad3c6687
Коммит 157dffcb8e
4 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -31,5 +31,7 @@ job-template:
command: > command: >
cd /builds/worker/checkouts/gecko && cd /builds/worker/checkouts/gecko &&
./mach python build/upload_generated_sources.py ${ARTIFACT_URL} ./mach python build/upload_generated_sources.py ${ARTIFACT_URL}
optimization:
only-if-dependencies-run: null
scopes: scopes:
- secrets:get:project/releng/gecko/build/level-{level}/gecko-generated-sources-upload - secrets:get:project/releng/gecko/build/level-{level}/gecko-generated-sources-upload

Просмотреть файл

@ -43,5 +43,7 @@ job-template:
GECKO_HEAD_REPOSITORY: # see transforms GECKO_HEAD_REPOSITORY: # see transforms
GECKO_HEAD_REV: # see transforms GECKO_HEAD_REV: # see transforms
ARTIFACT_TASKID: {"task-reference": "<build>"} ARTIFACT_TASKID: {"task-reference": "<build>"}
optimization:
only-if-dependencies-run: null
scopes: scopes:
- docker-worker:image:taskclusterprivate/upload_symbols:0.0.4 - docker-worker:image:taskclusterprivate/upload_symbols:0.0.4

Просмотреть файл

@ -77,6 +77,7 @@ def _make_default_strategies():
'skip-unless-changed': SkipUnlessChanged(), 'skip-unless-changed': SkipUnlessChanged(),
'skip-unless-schedules': SkipUnlessSchedules(), 'skip-unless-schedules': SkipUnlessSchedules(),
'skip-unless-schedules-or-seta': Either(SkipUnlessSchedules(), SETA()), 'skip-unless-schedules-or-seta': Either(SkipUnlessSchedules(), SETA()),
'only-if-dependencies-run': OnlyIfDependenciesRun(),
} }
@ -281,6 +282,18 @@ class Either(OptimizationStrategy):
lambda sub, arg: sub.should_replace_task(task, params, arg)) lambda sub, arg: sub.should_replace_task(task, params, arg))
class OnlyIfDependenciesRun(OptimizationStrategy):
"""Run this taks only if its dependencies run."""
# This takes advantage of the behavior of the second phase of optimization:
# a task can only be replaced if it has no un-optimized dependencies. So if
# should_replace_task is called, then a task has no un-optimized
# dependencies and can be removed (indicated by returning True)
def should_replace_task(self, task, params, arg):
return True
class IndexSearch(OptimizationStrategy): class IndexSearch(OptimizationStrategy):
def should_remove_task(self, task, params, index_paths): def should_remove_task(self, task, params, index_paths):
"If this task has no dependencies, don't run it.." "If this task has no dependencies, don't run it.."

Просмотреть файл

@ -184,6 +184,9 @@ task_description_schema = Schema({
{'skip-unless-schedules': list(schedules.ALL_COMPONENTS)}, {'skip-unless-schedules': list(schedules.ALL_COMPONENTS)},
# skip if SETA or skip-unless-schedules says to # skip if SETA or skip-unless-schedules says to
{'skip-unless-schedules-or-seta': list(schedules.ALL_COMPONENTS)}, {'skip-unless-schedules-or-seta': list(schedules.ALL_COMPONENTS)},
# only run this task if its dependencies will run (useful for follow-on tasks that
# are unnecessary if the parent tasks are not run)
{'only-if-dependencies-run': None}
), ),
# the provisioner-id/worker-type for the task. The following parameters will # the provisioner-id/worker-type for the task. The following parameters will