"Fossies" - the Fresh Open Source Software Archive

Member "firefox-69.0.1/taskcluster/docs/optimization-schedules.rst" (17 Sep 2019, 5669 Bytes) of package /linux/www/firefox-69.0.1.source.tar.xz:

As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

Optimization and SCHEDULES

Most optimization of builds and tests is handled with SCHEDULES. The concept is this: we allocate tasks into named components, and associate a set of such components to each file in the source tree. Given a set of files changed in a push, we then calculate the union of components affected by each file, and remove tasks that are not tagged with any of them.

This optimization system is intended to be conservative. It represents what could possibly be affected, rather than any intuitive notion of what tasks would be useful to run for changes to a particular file. For example:

Exclusive and Inclusive

The first wrinkle in this "simple" plan is that there are a lot of files, and for the most part they all affect most components. But there are some components which are only affected by a well-defined set of files. For example, a Python lint component need only be scheduled when Python files are changed.

We divide the components into "exclusive" and "inclusive" components. Absent any other configuration, any file in the repository is assumed to affect all of the exclusive components and none of the inclusive components.

Exclusive components can be thought of as a series of families. For example, the platform (linux, windows, macosx, android) is a component family. The test suite (mochitest, reftest, xpcshell, etc.) is another. By default, source files are associated with every component in every family. This means tasks tagged with an exclusive component will always run, unless none of the modified source files are associated with that component.

But what if we only want to run a particular task when a pre-determined file is modified? This is where inclusive components are used. Any task tagged with an inclusive component will only be run when a source file associated with that component is modified. Lint tasks and well separated unittest tasks are good examples of things you might want to schedule inclusively.

A good way to keep this straight is to think of exclusive platform-family components (macosx, android, windows, linux) and inclusive linting components (py-lint, js-lint). An arbitrary file in the repository affects all platform families, but does not necessarily require a lint run. But we can configure mac-only files such as CoreLocationLocationProvider.mm to affect exclusively macosx, and Python files like preprocessor.py to affect py-lint in addition to the exclusive components.

It is also possible to define a file as affecting an inclusive component and nothing else. For example, the source code and configuration for the Python linting tasks does not affect any tasks other than linting.


Components are defined as either inclusive or exclusive in :pymozbuild.schedules.

File Annotation

Files are annotated with their affected components in moz.build files with stanzas like :

with Files('**/*.py'):
    SCHEDULES.inclusive += ['py-lint']

for inclusive components and :

with Files('*gradle*'):
    SCHEDULES.exclusive = ['android']

for exclusive components. Note the use of += for inclusive compoenents (as this is adding to the existing set of affected components) but = for exclusive components (as this is resetting the affected set to something smaller). For cases where an inclusive component is affected exclusively (such as the python-lint configuration in the example above), that component can be assigned to SCHEDULES.exclusive:

with Files('**/pep8rc'):
    SCHEDULES.exclusive = ['py-lint']

If multiple stanzas set SCHEDULES.exclusive, the last one will take precedence. Thus the following will set SCHEDULES.exclusive to hpux for all files except those under docs/. :

with Files('**'):
    SCHEDULES.exclusive = ['hpux']

with Files('**/docs'):
    SCHEDULES.exclusive = ['docs']

Task Annotation

Tasks are annotated with the components they belong to using the "skip-unless-schedules" optimization, which takes a list of components for this task:

task['optimization'] = {'skip-unless-schedules': ['windows', 'gtest']}

For tests, this value is set automatically by the test transform based on the suite name and the platform family, doing the correct thing for inclusive test suites. Tests also use SETA via "skip-unless-schedules-or-seta", which skips a task if it is not affected or if SETA deems it unimportant.