def preprocess_jobs_stdin(stdin=sys.stdin, stdout=sys.stdout) -> None:
    # load the json from stdin
    job_dicts = json.load(stdin)

    # parse the job dictionaries into hpc Job objects
    jobs = [Job.from_dict(n) for n in job_dicts]

    # run our preprocessing
    modified_jobs = preprocess_jobs(jobs)

    # finally dump the modified jobs out to stdout
    json.dump(modified_jobs, stdout, default=lambda x: x.to_dict())
Ejemplo n.º 2
0
def test_job_json(a: Job):
    b = Job.from_dict(a.to_dict())
    assert _cmp(a, b)