Commit 18413d4f authored by Zixian Cai's avatar Zixian Cai

Support running multiple config files

parent bb5dc64c
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
import logging import logging
import click import click
import json import json
import sys
from mubench.frontend.utils import go_through_pipelines, platform_info from mubench.frontend.utils import go_through_pipelines, platform_info
from mubench.models.revision import LocalRevision from mubench.models.revision import LocalRevision
...@@ -25,7 +26,7 @@ logger = logging.getLogger(__name__) ...@@ -25,7 +26,7 @@ logger = logging.getLogger(__name__)
@click.command() @click.command()
@click.argument('file', type=click.Path(exists=True)) @click.argument('file', nargs=-1, type=click.Path(exists=True))
@click.option("--pipeline", default="box,bar", @click.option("--pipeline", default="box,bar",
help="Combination of [{}], separated by comma".format( help="Combination of [{}], separated by comma".format(
",".join(pipelines.keys()) ",".join(pipelines.keys())
...@@ -38,6 +39,9 @@ logger = logging.getLogger(__name__) ...@@ -38,6 +39,9 @@ logger = logging.getLogger(__name__)
@click.option("--dump", default=None, @click.option("--dump", default=None,
help="Dump log file to path") help="Dump log file to path")
def local(file, pipeline, skip_compile, dump): def local(file, pipeline, skip_compile, dump):
if len(file) == 0:
logger.fatal("Too few files")
sys.exit(1)
logger.info("Constructing a LocalRevision") logger.info("Constructing a LocalRevision")
revision = LocalRevision(file) revision = LocalRevision(file)
logger.info("Running tasks specified in file") logger.info("Running tasks specified in file")
......
...@@ -301,6 +301,9 @@ def load_yaml(yaml_s, run_dir): ...@@ -301,6 +301,9 @@ def load_yaml(yaml_s, run_dir):
return tasksets return tasksets
def load_file(config_file): def load_file(config_files):
with open(config_file) as fp: tasksets = []
return load_yaml(fp.read(), Path(config_file).parent) for config_file in config_files:
with open(config_file) as fp:
tasksets.extend(load_yaml(fp.read(), Path(config_file).parent))
return tasksets
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment