зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1748926 - Replace 'task.py' with the one in vendored taskgraph, r=taskgraph-reviewers,jmaher
Depends on D140734 Differential Revision: https://phabricator.services.mozilla.com/D140735
This commit is contained in:
Родитель
044c8ee19e
Коммит
1cd20cd65a
|
@ -9,13 +9,13 @@ import copy
|
|||
import attr
|
||||
from taskgraph.config import GraphConfig
|
||||
from taskgraph.parameters import parameters_loader
|
||||
from taskgraph.task import Task
|
||||
from taskgraph.util.yaml import load_yaml
|
||||
|
||||
from . import filter_tasks
|
||||
from .graph import Graph
|
||||
from .morph import morph
|
||||
from .optimize import optimize_task_graph
|
||||
from .task import Task
|
||||
from .taskgraph import TaskGraph
|
||||
from .transforms.base import TransformSequence, TransformConfig
|
||||
from .util.python_path import find_object
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
import copy
|
||||
|
||||
from taskgraph.task import Task
|
||||
from voluptuous import Required
|
||||
|
||||
from ..task import Task
|
||||
from ..util.attributes import sorted_unique_list
|
||||
from ..util.schema import Schema
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
import copy
|
||||
|
||||
from taskgraph.task import Task
|
||||
from voluptuous import Required
|
||||
|
||||
from ..task import Task
|
||||
from ..util.schema import Schema
|
||||
|
||||
schema = Schema(
|
||||
|
|
|
@ -25,8 +25,8 @@ import re
|
|||
|
||||
|
||||
from slugid import nice as slugid
|
||||
from taskgraph.task import Task
|
||||
|
||||
from .task import Task
|
||||
from .graph import Graph
|
||||
from .taskgraph import TaskGraph
|
||||
from .util.attributes import release_level
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
# 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/.
|
||||
|
||||
|
||||
import attr
|
||||
|
||||
|
||||
@attr.s
|
||||
class Task:
|
||||
"""
|
||||
Representation of a task in a TaskGraph. Each Task has, at creation:
|
||||
|
||||
- kind: the name of the task kind
|
||||
- label; the label for this task
|
||||
- attributes: a dictionary of attributes for this task (used for filtering)
|
||||
- task: the task definition (JSON-able dictionary)
|
||||
- optimization: optimization to apply to the task (see gecko_taskgraph.optimize)
|
||||
- dependencies: tasks this one depends on, in the form {name: label}, for example
|
||||
{'build': 'build-linux64/opt', 'docker-image': 'docker-image-desktop-test'}
|
||||
- soft_dependencies: tasks this one may depend on if they are available post
|
||||
optimisation. They are set as a list of tasks label.
|
||||
- if_dependencies: only run this task if at least one of these dependencies
|
||||
are present.
|
||||
|
||||
And later, as the task-graph processing proceeds:
|
||||
|
||||
- task_id -- TaskCluster taskId under which this task will be created
|
||||
|
||||
This class is just a convenience wrapper for the data type and managing
|
||||
display, comparison, serialization, etc. It has no functionality of its own.
|
||||
"""
|
||||
|
||||
kind = attr.ib()
|
||||
label = attr.ib()
|
||||
attributes = attr.ib()
|
||||
task = attr.ib()
|
||||
description = attr.ib(default="")
|
||||
task_id = attr.ib(default=None, init=False)
|
||||
optimization = attr.ib(default=None)
|
||||
dependencies = attr.ib(factory=dict)
|
||||
soft_dependencies = attr.ib(factory=list)
|
||||
if_dependencies = attr.ib(factory=list)
|
||||
|
||||
def __attrs_post_init__(self):
|
||||
self.attributes["kind"] = self.kind
|
||||
|
||||
def to_json(self):
|
||||
rv = {
|
||||
"kind": self.kind,
|
||||
"label": self.label,
|
||||
"description": self.description,
|
||||
"attributes": self.attributes,
|
||||
"dependencies": self.dependencies,
|
||||
"soft_dependencies": sorted(self.soft_dependencies),
|
||||
"if_dependencies": self.if_dependencies,
|
||||
"optimization": self.optimization,
|
||||
"task": self.task,
|
||||
}
|
||||
if self.task_id:
|
||||
rv["task_id"] = self.task_id
|
||||
return rv
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, task_dict):
|
||||
"""
|
||||
Given a data structure as produced by taskgraph.to_json, re-construct
|
||||
the original Task object. This is used to "resume" the task-graph
|
||||
generation process, for example in Action tasks.
|
||||
"""
|
||||
rv = cls(
|
||||
kind=task_dict["kind"],
|
||||
label=task_dict["label"],
|
||||
description=task_dict.get("description", ""),
|
||||
attributes=task_dict["attributes"],
|
||||
task=task_dict["task"],
|
||||
optimization=task_dict["optimization"],
|
||||
dependencies=task_dict.get("dependencies"),
|
||||
soft_dependencies=task_dict.get("soft_dependencies"),
|
||||
if_dependencies=task_dict.get("if_dependencies"),
|
||||
)
|
||||
if "task_id" in task_dict:
|
||||
rv.task_id = task_dict["task_id"]
|
||||
return rv
|
|
@ -2,9 +2,9 @@
|
|||
# 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 taskgraph.task import Task
|
||||
|
||||
from .graph import Graph
|
||||
from .task import Task
|
||||
|
||||
import attr
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
import unittest
|
||||
|
||||
from taskgraph.config import GraphConfig
|
||||
from taskgraph.task import Task
|
||||
from unittest import mock
|
||||
|
||||
from gecko_taskgraph import create
|
||||
from gecko_taskgraph.graph import Graph
|
||||
from gecko_taskgraph.taskgraph import TaskGraph
|
||||
from gecko_taskgraph.task import Task
|
||||
|
||||
from mozunit import main
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
import pytest
|
||||
from taskgraph.parameters import Parameters
|
||||
from taskgraph.task import Task
|
||||
|
||||
from gecko_taskgraph import morph
|
||||
from gecko_taskgraph.graph import Graph
|
||||
from gecko_taskgraph.taskgraph import TaskGraph
|
||||
from gecko_taskgraph.task import Task
|
||||
|
||||
from mozunit import main
|
||||
|
||||
|
|
|
@ -7,11 +7,12 @@ from datetime import datetime, timedelta
|
|||
from functools import partial
|
||||
|
||||
import pytest
|
||||
from mozunit import main
|
||||
from taskgraph.task import Task
|
||||
|
||||
from gecko_taskgraph import graph, optimize
|
||||
from gecko_taskgraph.optimize import OptimizationStrategy, All, Any, Not
|
||||
from gecko_taskgraph.taskgraph import TaskGraph
|
||||
from gecko_taskgraph.task import Task
|
||||
from mozunit import main
|
||||
|
||||
|
||||
class Remove(OptimizationStrategy):
|
||||
|
|
|
@ -8,6 +8,7 @@ from time import mktime
|
|||
|
||||
import pytest
|
||||
from mozunit import main
|
||||
from taskgraph.task import Task
|
||||
|
||||
from gecko_taskgraph.optimize import project, registry
|
||||
from gecko_taskgraph.optimize.strategies import IndexSearch, SkipUnlessSchedules
|
||||
|
@ -18,7 +19,6 @@ from gecko_taskgraph.optimize.bugbug import (
|
|||
FALLBACK,
|
||||
SkipUnlessDebug,
|
||||
)
|
||||
from gecko_taskgraph.task import Task
|
||||
from gecko_taskgraph.util.backstop import BACKSTOP_PUSH_INTERVAL
|
||||
from gecko_taskgraph.util.bugbug import (
|
||||
BUGBUG_BASE_URL,
|
||||
|
|
|
@ -9,12 +9,12 @@ import unittest
|
|||
|
||||
import pytest
|
||||
from mozunit import main
|
||||
from taskgraph.task import Task
|
||||
|
||||
from gecko_taskgraph import target_tasks
|
||||
from gecko_taskgraph import try_option_syntax
|
||||
from gecko_taskgraph.graph import Graph
|
||||
from gecko_taskgraph.taskgraph import TaskGraph
|
||||
from gecko_taskgraph.task import Task
|
||||
|
||||
|
||||
class FakeTryOptionSyntax:
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from taskgraph.task import Task
|
||||
|
||||
from gecko_taskgraph.graph import Graph
|
||||
from gecko_taskgraph.task import Task
|
||||
from gecko_taskgraph.taskgraph import TaskGraph
|
||||
from mozunit import main
|
||||
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mozunit import main
|
||||
from taskgraph.task import Task
|
||||
|
||||
from gecko_taskgraph.try_option_syntax import TryOptionSyntax, parse_message
|
||||
from gecko_taskgraph.graph import Graph
|
||||
from gecko_taskgraph.taskgraph import TaskGraph
|
||||
from gecko_taskgraph.task import Task
|
||||
from mozunit import main
|
||||
|
||||
|
||||
def unittest_task(n, tp, bt="opt"):
|
||||
|
|
|
@ -5,11 +5,12 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from mozunit import main
|
||||
from taskgraph.task import Task
|
||||
|
||||
from gecko_taskgraph.decision import full_task_graph_to_runnable_jobs
|
||||
from gecko_taskgraph.graph import Graph
|
||||
from gecko_taskgraph.taskgraph import TaskGraph
|
||||
from gecko_taskgraph.task import Task
|
||||
from mozunit import main
|
||||
|
||||
|
||||
class TestRunnableJobs(unittest.TestCase):
|
||||
|
|
|
@ -8,6 +8,7 @@ import logging
|
|||
|
||||
import taskcluster_urls as liburls
|
||||
from taskcluster import Hooks
|
||||
from taskgraph.task import Task
|
||||
from taskgraph.util import taskcluster as tc_util
|
||||
from taskgraph.util.taskcluster import (
|
||||
_do_request,
|
||||
|
@ -17,8 +18,6 @@ from taskgraph.util.taskcluster import (
|
|||
get_task_url,
|
||||
)
|
||||
|
||||
from gecko_taskgraph.task import Task
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ import yaml
|
|||
from unittest.mock import MagicMock
|
||||
from moztest.resolve import TestResolver
|
||||
from gecko_taskgraph.graph import Graph
|
||||
from gecko_taskgraph.task import Task
|
||||
from gecko_taskgraph.taskgraph import TaskGraph
|
||||
from taskgraph.task import Task
|
||||
|
||||
from tryselect import push
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче