Exemple #1
0
def test_log_prefix_dynamic_default(path: pathlib.Path) -> None:
    """ Check that the log_prefix is set dynamically when it is omitted """
    data = DEFAULT_ARGUMENTS.copy()
    data["path"] = path
    data.update(path=path)
    job = htclib.HTCondorJob(**data)
    assert job.log_prefix == path.parent / path.stem
Exemple #2
0
def create_job():
    job = htclib.HTCondorJob(
        path=JOB_DIR / "job.txt",
        proc_user="******",
        docker_image="alexgleith/cdo",
        memory="3G",
        log_prefix=JOB_DIR / "logs",
        executable="/usr/local/bin/cdo",
        arguments=
        "-O -z zip -seltimestep,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47 -remapbil,gridfile.txt $(input_file) $(output_file)",
        input_files="./gridfile.txt",
        queue=f"input_file,output_file from {JOB_DIR / 'arguments.csv'}",
    )
    print(job)
    return job
Exemple #3
0
def create_job(job_file: pathlib.Path, input_file: pathlib.Path,
               output_file: pathlib.Path) -> htclib.HTCondorJob:
    """
    Create and return an HTCondorJob object

    Arguments
    ---------

    job_file: The path to the job description/submission file
    input_file: The path to the NetCDF file we want to process
    output_file: The path where we want to save the output NetCDF file

    """
    arguments = " ".join(
        [CONDOR_BASE_ARGUMENTS,
         input_file.as_posix(),
         output_file.as_posix()])
    job = htclib.HTCondorJob(path=job_file,
                             arguments=arguments,
                             **COMMON_OPTIONS)
    return job
Exemple #4
0
def test_log_prefix_explicit_value() -> None:
    data = DEFAULT_ARGUMENTS.copy()
    data["log_prefix"] = pathlib.Path("log_prefix")
    job = htclib.HTCondorJob(**data)
    assert job.log_prefix == data["log_prefix"]
Exemple #5
0
def tmp_job(tmp_path: pathlib.Path) -> htclib.HTCondorJob:
    data = DEFAULT_ARGUMENTS.copy()
    data["path"] = tmp_path / "htclib.job"
    job = htclib.HTCondorJob(**data)
    return job