Beispiel #1
0
def main():
    """run cptools.job.Job on a yaml file containing arguments"""
    parser = argparse.ArgumentParser()
    parser.add_argument("-t", "--template", action="store_true")
    args, unknown = parser.parse_known_args()
    if args.template:
        # print out template and exit
        template.print_template()
        sys.exit(0)
    print(
        green(
            textwrap.dedent("""\
      ___ ___ _____ ___   ___  _    ___ ___
     / __| _ \_   _/ _ \ / _ \| |  / __|_  )
    | (__|  _/ | || (_) | (_) | |__\__ \/ /
     \___|_|   |_| \___/ \___/|____|___/___|
    """)))
    check_arguments()
    # parse yaml file into a dictionary
    path_to_config = sys.argv[1]
    config = parse_config.Config(path_to_config)
    pretty_print("parsing config file {}".format(
        colours.yellow(path_to_config)))
    configure_job(config)
    pretty_print("creating SGE script")
    make_scripts(config)
    pretty_print("DONE!")
def test_create_commands():
    config = parse_config.Config(TEST_PATH)
    pipeline_loc = os.path.abspath("./tests/example_pipeline.cppipe")
    expected = {
        "pipeline": pipeline_loc,
        "location": "/example/location",
        "commands_location": "/home/user",
        "job_size": 46,
        "channel_dict": None,
    }
    assert config.create_command_args() == expected
def test_open_yaml():
    config = parse_config.Config(TEST_PATH)
    config_dict = config.config_dict
    assert isinstance(config_dict, dict)
def test_remove_plate():
    config = parse_config.Config(TEST_PATH)
    assert config.remove_plate == ["plate_1", "plate_2"]
def test_add_plate():
    config = parse_config.Config(TEST_PATH)
    assert config.add_plate == {
        "exp_dir": "/path/to/new/experiment",
        "plates": ["plate_3", "plate_4"]
    }
def test_chunk():
    config = parse_config.Config(TEST_PATH)
    assert config.chunk == 46
def test_experiment():
    config = parse_config.Config(TEST_PATH)
    assert config.experiment == "/path/to/experiment"
def test_check_yaml_args():
    with pytest.raises(ValueError):
        config = parse_config.Config(TEST_BROKEN)