示例#1
0
def process_run(args: Namespace) -> None:
    """
    CLI command for running a study.

    :param [Namespace] `args`: parsed CLI arguments
    """
    print(banner_small)
    filepath: str = verify_filepath(args.specification)
    variables_dict: str = parse_override_vars(args.variables)
    samples_file: Optional[str] = None
    if args.samples_file:
        samples_file = verify_filepath(args.samples_file)

    # pgen checks
    if args.pargs and not args.pgen_file:
        raise ValueError(
            "Cannot use the 'pargs' parameter without specifying a 'pgen'!")
    if args.pgen_file:
        verify_filepath(args.pgen_file)

    study: MerlinStudy = MerlinStudy(
        filepath,
        override_vars=variables_dict,
        samples_file=samples_file,
        dry_run=args.dry,
        no_errors=args.no_errors,
        pgen_file=args.pgen_file,
        pargs=args.pargs,
    )
    router.run_task_server(study, args.run_mode)
示例#2
0
def process_run(args):
    """
    CLI command for running a study.

    :param `args`: parsed CLI arguments
    """
    print(banner_small)
    filepath = verify_filepath(args.specification)
    variables_dict = parse_override_vars(args.variables)
    samples_file = None
    if args.samples_file:
        samples_file = verify_filepath(args.samples_file)
    study = MerlinStudy(
        filepath,
        override_vars=variables_dict,
        samples_file=samples_file,
        dry_run=args.dry,
        no_errors=args.no_errors,
    )
    router.run_task_server(study, args.run_mode)
示例#3
0
def process_restart(args):
    """
    CLI command for restarting a study.

    :param `args`: parsed CLI arguments
    """
    print(banner_small)
    restart_dir = verify_dirpath(args.restart_dir)
    filepath = os.path.join(args.restart_dir, "merlin_info", "*.expanded.yaml")
    possible_specs = glob.glob(filepath)
    if len(possible_specs) == 0:
        raise ValueError(
            f"'{filepath}' does not match any provenance spec file to restart from."
        )
    elif len(possible_specs) > 1:
        raise ValueError(
            f"'{filepath}' matches more than one provenance spec file to restart from."
        )
    filepath = verify_filepath(possible_specs[0])
    LOG.info(f"Restarting workflow at '{restart_dir}'")
    study = MerlinStudy(filepath, restart_dir=restart_dir)
    router.run_task_server(study, args.run_mode)