# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
from collections import deque
import taskgraph from taskgraph.transforms.base import TransformSequence
from gecko_taskgraph.util.cached_tasks import add_optimization
transforms = TransformSequence()
def order_tasks(config, tasks): """Iterate image tasks in an order where parent tasks come first."""
kind_prefix = config.kind + "-"
pending = deque(tasks)
task_labels = {task["label"] for task in pending}
emitted = set() whileTrue: try:
task = pending.popleft() except IndexError: break
parents = {
task for task in task.get("dependencies", {}).values() if task.startswith(kind_prefix)
} if parents andnot emitted.issuperset(parents & task_labels):
pending.append(task) continue
emitted.add(task["label"]) yield task
@transforms.add def cache_task(config, tasks): if taskgraph.fast: for task in tasks: yield task return
digests = {} for task in config.kind_dependencies_tasks.values(): if ( "cached_task"in task.attributes and task.attributes["cached_task"] isnotFalse
):
digests[task.label] = format_task_digest(task.attributes["cached_task"])
for task in order_tasks(config, tasks):
cache = task.pop("cache", None) if cache isNone: yield task continue
dependency_digests = [] for p in task.get("dependencies", {}).values(): if p in digests:
dependency_digests.append(digests[p]) elif config.params["project"] == "toolchains": # The toolchains repository uses non-cached toolchain artifacts. Allow # tasks to use them.
cache = None break else: raise Exception( "Cached task {} has uncached parent task: {}".format(
task["label"], p
)
)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.