Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies = [
"cookiecutter~=2.1",
"json-e>=2.7",
"mozilla-repo-urls",
"msgspec>=0.19.0",
"PyYAML>=5.3.1",
"redo>=2.0",
"requests>=2.25",
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

from .util.caches import CACHES
from .util.python_path import find_object
from .util.schema import Schema, optionally_keyed_by, validate_schema
from .util.schema import LegacySchema, optionally_keyed_by, validate_schema
from .util.vcs import get_repository
from .util.yaml import load_yaml

logger = logging.getLogger(__name__)


#: Schema for the graph config
graph_config_schema = Schema(
graph_config_schema = LegacySchema(
{
# The trust-domain for this graph.
# (See https://firefox-source-docs.mozilla.org/taskcluster/taskcluster/taskgraph.html#taskgraph-trust-domain) # noqa
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from taskgraph.taskgraph import TaskGraph
from taskgraph.util import json
from taskgraph.util.python_path import find_object
from taskgraph.util.schema import Schema, validate_schema
from taskgraph.util.schema import LegacySchema, validate_schema
from taskgraph.util.vcs import get_repository
from taskgraph.util.yaml import load_yaml

Expand All @@ -40,7 +40,7 @@


#: Schema for try_task_config.json version 2
try_task_config_schema_v2 = Schema(
try_task_config_schema_v2 = LegacySchema(
{
Optional("parameters"): {str: object},
}
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/transforms/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from ..config import GraphConfig
from ..parameters import Parameters
from ..util.schema import Schema, validate_schema
from ..util.schema import LegacySchema, validate_schema


@dataclass(frozen=True)
Expand Down Expand Up @@ -138,7 +138,7 @@ def add_validate(self, schema):

@dataclass
class ValidateSchema:
schema: Schema
schema: LegacySchema

def __call__(self, config, tasks):
for task in tasks:
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/transforms/chunking.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from voluptuous import ALLOW_EXTRA, Optional, Required

from taskgraph.transforms.base import TransformSequence
from taskgraph.util.schema import Schema
from taskgraph.util.schema import LegacySchema
from taskgraph.util.templates import substitute

#: Schema for chunking transforms
CHUNK_SCHEMA = Schema(
CHUNK_SCHEMA = LegacySchema(
{
# Optional, so it can be used for a subset of tasks in a kind
Optional(
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/transforms/docker_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from taskgraph.transforms.base import TransformSequence
from taskgraph.util import json
from taskgraph.util.docker import create_context_tar, generate_context_hash
from taskgraph.util.schema import Schema
from taskgraph.util.schema import LegacySchema

from .task import task_description_schema

Expand All @@ -32,7 +32,7 @@
transforms = TransformSequence()

#: Schema for docker_image transforms
docker_image_schema = Schema(
docker_image_schema = LegacySchema(
{
Required(
"name",
Expand Down
8 changes: 4 additions & 4 deletions src/taskgraph/transforms/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

from ..util import path
from ..util.cached_tasks import add_optimization
from ..util.schema import Schema, validate_schema
from ..util.schema import LegacySchema, validate_schema
from ..util.treeherder import join_symbol
from .base import TransformSequence

CACHE_TYPE = "content.v1"

#: Schema for fetch transforms
FETCH_SCHEMA = Schema(
FETCH_SCHEMA = LegacySchema(
{
Required(
"name",
Expand Down Expand Up @@ -87,12 +87,12 @@

@dataclass(frozen=True)
class FetchBuilder:
schema: Schema
schema: LegacySchema
builder: Callable


def fetch_builder(name, schema):
schema = Schema({Required("type"): name}).extend(schema)
schema = LegacySchema({Required("type"): name}).extend(schema)

def wrap(func):
fetch_builders[name] = FetchBuilder(schema, func) # type: ignore
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/transforms/from_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
from taskgraph.transforms.run import fetches_schema
from taskgraph.util.attributes import attrmatch
from taskgraph.util.dependencies import GROUP_BY_MAP, get_dependencies
from taskgraph.util.schema import Schema, validate_schema
from taskgraph.util.schema import LegacySchema, validate_schema
from taskgraph.util.set_name import SET_NAME_MAP

#: Schema for from_deps transforms
FROM_DEPS_SCHEMA = Schema(
FROM_DEPS_SCHEMA = LegacySchema(
{
Required("from-deps"): {
Optional(
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/transforms/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
from voluptuous import ALLOW_EXTRA, Extra, Optional, Required

from taskgraph.transforms.base import TransformSequence
from taskgraph.util.schema import Schema
from taskgraph.util.schema import LegacySchema
from taskgraph.util.templates import substitute_task_fields

#: Schema for matrix transforms
MATRIX_SCHEMA = Schema(
MATRIX_SCHEMA = LegacySchema(
{
Required("name"): str,
Optional("matrix"): {
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/transforms/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from voluptuous import ALLOW_EXTRA, Any, Exclusive, Optional, Required

from taskgraph.transforms.base import TransformSequence
from taskgraph.util.schema import Schema, optionally_keyed_by, resolve_keyed_by
from taskgraph.util.schema import LegacySchema, optionally_keyed_by, resolve_keyed_by

_status_type = Any(
"on-completed",
Expand Down Expand Up @@ -55,7 +55,7 @@
"""Map each type to its primary key that will be used in the route."""

#: Schema for notify transforms
NOTIFY_SCHEMA = Schema(
NOTIFY_SCHEMA = LegacySchema(
{
Exclusive("notify", "config"): {
Required("recipients"): [Any(*_recipients)],
Expand Down
6 changes: 3 additions & 3 deletions src/taskgraph/transforms/run/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from taskgraph.util import json
from taskgraph.util import path as mozpath
from taskgraph.util.python_path import import_sibling_modules
from taskgraph.util.schema import Schema, validate_schema
from taskgraph.util.schema import LegacySchema, validate_schema
from taskgraph.util.taskcluster import get_artifact_prefix
from taskgraph.util.workertypes import worker_type_implementation

Expand All @@ -38,7 +38,7 @@
}

#: Schema for a run transforms
run_description_schema = Schema(
run_description_schema = LegacySchema(
{
Optional(
"name",
Expand Down Expand Up @@ -457,7 +457,7 @@ def wrap(func):


@run_task_using(
"always-optimized", "always-optimized", Schema({"using": "always-optimized"})
"always-optimized", "always-optimized", LegacySchema({"using": "always-optimized"})
)
def always_optimized(config, task, taskdesc):
pass
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/transforms/run/index_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

from taskgraph.transforms.base import TransformSequence
from taskgraph.transforms.run import run_task_using
from taskgraph.util.schema import Schema
from taskgraph.util.schema import LegacySchema

transforms = TransformSequence()


#: Schema for run.using index-search
run_task_schema = Schema(
run_task_schema = LegacySchema(
{
Required("using"): "index-search",
Required(
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/transforms/run/run_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from taskgraph.transforms.task import taskref_or_string
from taskgraph.util import path, taskcluster
from taskgraph.util.caches import CACHES
from taskgraph.util.schema import Schema
from taskgraph.util.schema import LegacySchema

EXEC_COMMANDS = {
"bash": ["bash", "-cx"],
Expand All @@ -28,7 +28,7 @@


#: Schema for run.using run_task
run_task_schema = Schema(
run_task_schema = LegacySchema(
{
Required(
"using",
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/transforms/run/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
)
from taskgraph.util import path as mozpath
from taskgraph.util.hash import hash_paths
from taskgraph.util.schema import Schema
from taskgraph.util.schema import LegacySchema
from taskgraph.util.shell import quote as shell_quote

CACHE_TYPE = "toolchains.v3"

#: Schema for run.using toolchain
toolchain_run_schema = Schema(
toolchain_run_schema = LegacySchema(
{
Required(
"using",
Expand Down
12 changes: 6 additions & 6 deletions src/taskgraph/transforms/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from taskgraph.util.hash import hash_path
from taskgraph.util.keyed_by import evaluate_keyed_by
from taskgraph.util.schema import (
LegacySchema,
OptimizationSchema,
Schema,
optionally_keyed_by,
resolve_keyed_by,
taskref_or_string,
Expand All @@ -50,7 +50,7 @@ def _run_task_suffix():


#: Schema for the task transforms
task_description_schema = Schema(
task_description_schema = LegacySchema(
{
Required(
"label",
Expand Down Expand Up @@ -432,14 +432,14 @@ def get_default_deadline(graph_config, project):

@dataclass(frozen=True)
class PayloadBuilder:
schema: Schema
schema: LegacySchema
builder: Callable


def payload_builder(name, schema):
schema = Schema({Required("implementation"): name, Optional("os"): str}).extend(
schema
)
schema = LegacySchema(
{Required("implementation"): name, Optional("os"): str}
).extend(schema)

def wrap(func):
assert name not in payload_builders, f"duplicate payload builder name {name}"
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/transforms/task_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from voluptuous import ALLOW_EXTRA, Any, Optional, Required

from taskgraph.transforms.base import TransformSequence
from taskgraph.util.schema import Schema
from taskgraph.util.schema import LegacySchema
from taskgraph.util.templates import deep_get, substitute_task_fields
from taskgraph.util.yaml import load_yaml

#: Schema for the task_context transforms
SCHEMA = Schema(
SCHEMA = LegacySchema(
{
Optional("name"): str,
Optional(
Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/util/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from taskgraph.task import Task
from taskgraph.transforms.base import TransformConfig
from taskgraph.util.schema import Schema
from taskgraph.util.schema import LegacySchema

# Define a collection of group_by functions
GROUP_BY_MAP = {}
Expand Down Expand Up @@ -36,7 +36,7 @@ def group_by_all(config, tasks):
return [[task for task in tasks]]


@group_by("attribute", schema=Schema(str))
@group_by("attribute", schema=LegacySchema(str))
def group_by_attribute(config, tasks, attr):
groups = {}
for task in tasks:
Expand Down
Loading
Loading