Verified Commit 68cfb20e authored by Hines, Jesse's avatar Hines, Jesse
Browse files

Move read_yaml to utils so we can reuse it

parent 6699940d
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ from raps.ui import LayoutManager
from raps.plotting import Plotter
from raps.engine import Engine
from raps.multi_part_engine import MultiPartEngine
from raps.utils import write_dict_to_file, pydantic_add_args, SubParsers, yaml_dump
from raps.utils import write_dict_to_file, pydantic_add_args, SubParsers, yaml_dump, read_yaml
from raps.stats import (
    get_engine_stats,
    get_job_stats,
@@ -25,15 +25,6 @@ from raps.stats import (
from raps.sim_config import SingleSimConfig, MultiPartSimConfig, SIM_SHORTCUTS


def read_yaml(config_file: str):
    if config_file == "-":
        return yaml.safe_load(sys.stdin.read())
    elif config_file:
        return yaml.safe_load(Path(config_file).read_text())
    else:
        return {}


def run_sim_add_parser(subparsers: SubParsers):
    parser = subparsers.add_parser("run", description="""
        Run single-partition (homogeneous) systems. Supports synthetic workload generation or
+10 −0
Original line number Diff line number Diff line
@@ -750,6 +750,16 @@ def yaml_dump(data):
    )


def read_yaml(config_file: str):
    """ Parses yaml file. Pass "-" to read from stdin """
    if config_file == "-":
        return yaml.safe_load(sys.stdin.read())
    elif config_file:
        return yaml.safe_load(Path(config_file).read_text())
    else:
        return {}


class WorkloadData(RAPSBaseModel):
    """
    Represents a workload, a list of jobs with some metadata. Returned by dataloaders load_data()