зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset ec6b9fda1868 (bug 1415199) for breaking gecko decision task. r=backout on a CLOSED TREE
This commit is contained in:
Родитель
032b57d3ec
Коммит
1aa3eb5efc
|
@ -1784,7 +1784,7 @@ class PackageFrontend(MachCommandBase):
|
|||
import requests
|
||||
import shutil
|
||||
|
||||
from taskgraph.generator import load_graph_config, Kind
|
||||
from taskgraph.generator import Kind
|
||||
from taskgraph.util.taskcluster import (
|
||||
get_artifact_url,
|
||||
list_artifacts,
|
||||
|
@ -1905,14 +1905,15 @@ class PackageFrontend(MachCommandBase):
|
|||
}
|
||||
|
||||
# TODO: move to the taskcluster package
|
||||
def tasks(kind_name):
|
||||
root_path = mozpath.join(self.topsrcdir, 'taskcluster', 'ci')
|
||||
graph_config = load_graph_config(root_path)
|
||||
tasks = Kind.load(root_path, graph_config, kind_name).load_tasks(params, {})
|
||||
return {
|
||||
task.task['metadata']['name']: task
|
||||
for task in tasks
|
||||
}
|
||||
def tasks(kind):
|
||||
kind_path = mozpath.join(self.topsrcdir, 'taskcluster', 'ci', kind)
|
||||
with open(mozpath.join(kind_path, 'kind.yml')) as f:
|
||||
config = yaml.load(f)
|
||||
tasks = Kind(kind, kind_path, config).load_tasks(params, {})
|
||||
return {
|
||||
task.task['metadata']['name']: task
|
||||
for task in tasks
|
||||
}
|
||||
|
||||
toolchains = tasks('toolchain')
|
||||
|
||||
|
|
|
@ -25,12 +25,6 @@ from .config import validate_graph_config
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class KindNotFound(Exception):
|
||||
"""
|
||||
Raised when trying to load kind from a directory without a kind.yml.
|
||||
"""
|
||||
|
||||
|
||||
class Kind(object):
|
||||
|
||||
def __init__(self, name, path, config, graph_config):
|
||||
|
@ -73,31 +67,6 @@ class Kind(object):
|
|||
for task_dict in transforms(trans_config, inputs)]
|
||||
return tasks
|
||||
|
||||
@classmethod
|
||||
def load(cls, root_dir, graph_config, kind_name):
|
||||
path = os.path.join(root_dir, kind_name)
|
||||
kind_yml = os.path.join(path, 'kind.yml')
|
||||
if not os.path.exists(kind_yml):
|
||||
raise KindNotFound(kind_yml)
|
||||
|
||||
logger.debug("loading kind `{}` from `{}`".format(kind_name, path))
|
||||
with open(kind_yml) as f:
|
||||
config = yaml.load(f)
|
||||
|
||||
return cls(kind_name, path, config, graph_config)
|
||||
|
||||
|
||||
def load_graph_config(root_dir):
|
||||
config_yml = os.path.join(root_dir, "config.yml")
|
||||
if not os.path.exists(config_yml):
|
||||
raise Exception("Couldn't find taskgraph configuration: {}".format(config_yml))
|
||||
|
||||
logger.debug("loading config from `{}`".format(config_yml))
|
||||
with open(config_yml) as f:
|
||||
config = yaml.load(f)
|
||||
|
||||
return validate_graph_config(config)
|
||||
|
||||
|
||||
class TaskGraphGenerator(object):
|
||||
"""
|
||||
|
@ -213,15 +182,36 @@ class TaskGraphGenerator(object):
|
|||
return self._run_until('morphed_task_graph')
|
||||
|
||||
def _load_kinds(self, graph_config):
|
||||
for kind_name in os.listdir(self.root_dir):
|
||||
try:
|
||||
yield Kind.load(self.root_dir, graph_config, kind_name)
|
||||
except KindNotFound:
|
||||
for path in os.listdir(self.root_dir):
|
||||
path = os.path.join(self.root_dir, path)
|
||||
if not os.path.isdir(path):
|
||||
continue
|
||||
kind_name = os.path.basename(path)
|
||||
|
||||
kind_yml = os.path.join(path, 'kind.yml')
|
||||
if not os.path.exists(kind_yml):
|
||||
continue
|
||||
|
||||
logger.debug("loading kind `{}` from `{}`".format(kind_name, path))
|
||||
with open(kind_yml) as f:
|
||||
config = yaml.load(f)
|
||||
|
||||
yield Kind(kind_name, path, config, graph_config)
|
||||
|
||||
def _load_graph_config(self):
|
||||
config_yml = os.path.join(self.root_dir, "config.yml")
|
||||
if not os.path.exists(config_yml):
|
||||
raise Exception("Couldn't find taskgraph configuration: {}".format(config_yml))
|
||||
|
||||
logger.debug("loading config from `{}`".format(config_yml))
|
||||
with open(config_yml) as f:
|
||||
config = yaml.load(f)
|
||||
|
||||
return validate_graph_config(config)
|
||||
|
||||
def _run(self):
|
||||
logger.info("Loading graph configuration.")
|
||||
graph_config = self.load_graph_config(self.root_dir)
|
||||
graph_config = self._load_graph_config()
|
||||
|
||||
logger.info("Loading kinds")
|
||||
# put the kinds into a graph and sort topologically so that kinds are loaded
|
||||
|
|
Загрузка…
Ссылка в новой задаче