예제 #1
0
def test_no_job_event_log():
    desc = jobs.SubmitDescription(executable="/bin/sleep", arguments="5m")

    handle = jobs.submit(desc, count=1)

    with pytest.raises(jobs.exceptions.NoJobEventLog):
        handle.state
예제 #2
0
import htcondor_jobs as jobs

# todo: parse args using argparse

prefix = sys.argv[1]
num_tests_per_facility = int(sys.argv[2])

# todo: ensure the prefix dir actually exists

base_sub = jobs.SubmitDescription(
    # make sure that request_disk is large enough!
    transfer_input_files = 'file.txt',
    request_disk = '11GB',  # todo: automatically figure out request disk from size of input file
    # probably don't need to edit these
    requirements = 'Facility == "$(TargetFacility)"',
    executable = 'network.sh',
    request_memory = '50MB',
    log = '{}/$(Cluster).log'.format(prefix),
    output = '{}/$(Cluster).out'.format(prefix),
    error = '{}/$(Cluster).err'.format(prefix),
    submit_event_notes = '$(TargetFacility)',
)
base_sub['+TargetFacility'] = '"$(TargetFacility)"'

facilities = ['CS_2360', 'CS_3370A', 'CS_B240', 'WID']
facility_cycle = itertools.cycle(facilities)

for test_number, facility in zip(range(num_tests_per_facility * len(facilities)), facility_cycle):
    print(f'Sending test {test_number} to facility {facility}')
    sub = base_sub.copy(
        jobbatchname = str(test_number),
예제 #3
0
import htcondor_jobs as jobs

desc = jobs.SubmitDescription(
    universe="scheduler",
    executable="execute.py",
    getenv=True,
    log="test.log",
    output="test.output",
    error="test.error",
    stream_output="true",
    stream_error="true",
    **{
        "+DAGManJobID": "$(cluster)",
        "+OtherJobRemoveRequirements": "DAGManJobID =?= $(cluster)",  # todo: ?
    },
)

handle = jobs.submit(desc)
print(handle)
예제 #4
0
def short_sleep(tmp_path):
    return jobs.SubmitDescription(
        executable="/bin/sleep",
        arguments="1s",
        log=(tmp_path / "events.log").as_posix(),
    )
def desc():
    return jobs.SubmitDescription(**DESCRIPTORS.copy())
def test_init_from_combined():
    d = jobs.SubmitDescription({"foobar": "wizbang"}, foobar="woah")

    assert d["foobar"] == "woah"
def test_init_from_dict():
    d = jobs.SubmitDescription({"foobar": "wizbang"})

    assert d["foobar"] == "wizbang"
def test_init_from_kwargs():
    d = jobs.SubmitDescription(foobar="wizbang")

    assert d["foobar"] == "wizbang"