示例#1
0
def main(
    context: click.Context, research_tool: str, projects: tp.List[str]
) -> None:
    """Handle and simplify common developer interactions with the project."""
    initialize_cli_tool()

    tool = get_research_tool(research_tool)
    context.ensure_object(dict)
    context.obj["research_tool"] = tool

    project_list: tp.List[SubProject] = []
    if projects:
        if "all" in projects:
            tool.code_base.map_sub_projects(project_list.append)
        else:

            def __project_selector(sub_project: SubProject) -> None:
                lower_name = sub_project.name.lower()
                requested_sub_projects = projects
                map(str.lower, requested_sub_projects)
                if lower_name in requested_sub_projects:
                    project_list.append(sub_project)

            tool.code_base.map_sub_projects(__project_selector)

    context.obj["project_list"] = project_list
def main() -> None:
    """
    Main function for working with artefacts.

    `vara-art`
    """
    initialize_cli_tool()
    initialize_projects()
    initialize_reports()
    initialize_tables()
    initialize_plots()
    initialize_artefact_types()
示例#3
0
def main() -> None:
    """
    Main function for working with paper configs.

    `vara-pc`
    """
    initialize_cli_tool()

    if vara_cfg()["paper_config"]["folder"].value is None:
        # Setup default paper config path when none exists
        vara_cfg()["paper_config"]["folder"] = str(
            Path('paper_configs').absolute())
        save_config()
示例#4
0
def main(context: click.Context, **kwargs: tp.Any) -> None:
    """Entry point for the plot generation tool."""
    # store common options in context so they can be passed to subcommands
    common_options = CommonPlotOptions.from_kwargs(**kwargs)
    plot_config = PlotConfig.from_kwargs(**kwargs)
    context.ensure_object(dict)
    context.obj["common_options"] = common_options
    context.obj["plot_config"] = plot_config
    context.obj["save_artefact"] = kwargs["save_artefact"]

    initialize_cli_tool()
    initialize_projects()
    initialize_tables()
    initialize_plots()
示例#5
0
def main(
    verbose: int,
    slurm: bool,
    submit: bool,
    container: bool,
    experiment: str,
    projects: tp.List[str],
    pretend: bool,
) -> None:
    """
    Run benchbuild experiments.

    Runs on all projects in the current paper config by default. You can
    restrict this to only certain projects or even revisions using BenchBuild-
    style project selectors: <project>[@<revision>]
    """
    # pylint: disable=too-many-branches
    initialize_cli_tool()
    initialize_projects()

    bb_command_args: tp.List[str] = ["--force-watch-unbuffered"]
    bb_extra_args: tp.List[str] = []

    if sys.stdout.isatty():
        bb_command_args.append("--force-tty")

    if verbose:
        bb_command_args.append("-" + ("v" * verbose))

    if pretend:
        click.echo("Running in pretend mode. No experiments will be executed.")
        # benchbuild only supports pretend in the normal run command
        slurm = False
        container = False

    if slurm:
        bb_command_args.append("slurm")

    if container:
        if slurm:
            if not __is_slurm_prepared():
                click.echo("It seems like benchbuild is not properly "
                           "configured for slurm + containers. "
                           "Please run 'vara-container prepare-slurm' first.")
                sys.exit(1)
            bb_extra_args = ["--", "container", "run"]
            if bb_cfg()["container"]["import"].value:
                bb_extra_args.append("--import")
        else:
            bb_command_args.append("container")

    if not slurm:
        bb_command_args.append("run")

    if pretend:
        bb_command_args.append("-p")

    if not projects:
        projects = list({
            cs.project_name
            for cs in get_paper_config().get_all_case_studies()
        })

    bb_args = list(
        itertools.chain(bb_command_args, ["-E", experiment], projects,
                        bb_extra_args))

    with local.cwd(vara_cfg()["benchbuild_root"].value):
        try:
            with benchbuild[bb_args].bgrun(stdout=PIPE,
                                           stderr=PIPE) as bb_proc:
                try:
                    _, stdout, _ = tee(bb_proc)
                except KeyboardInterrupt:
                    # wait for BB to complete when Ctrl-C is pressed
                    retcode, _, _ = tee(bb_proc)
                    sys.exit(retcode)
        except ProcessExecutionError:
            sys.exit(1)

    if slurm:
        match = __SLURM_SCRIPT_PATTERN.search(stdout)
        if match:
            slurm_script = match.group(1)
            if submit:
                click.echo(
                    f"Submitting slurm script via sbatch: {slurm_script}")
                sbatch(slurm_script)
            else:
                click.echo(f"Run the following command to submit the slurm:\n"
                           f"sbatch {slurm_script}")
        else:
            click.echo("Could not find slurm script.")
            sys.exit(1)
示例#6
0
def main() -> None:
    """Allow easier management of case studies."""
    initialize_cli_tool()
    initialize_projects()
    initialize_reports()
示例#7
0
def main() -> None:
    """Start VaRA-TS driver and run application."""
    initialize_cli_tool()
    driver = VaRATSSetup()
    driver.main()
def main() -> None:
    """Build VaRA on cli."""
    initialize_cli_tool()