Here are the examples of the python api pytest.mark.slurm taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
View Complete Implementation : test_scheduler.py
Copyright Apache License 2.0
Author : gdikov
Copyright Apache License 2.0
Author : gdikov
@pytest.mark.slurm
@pytest.mark.timeout(60.0)
def test_slurm_from_script():
domain = Domain({"x": {0, 1, 2, 3}, "y": [-1., 1.], "z": {"123", "abc"}}, seed=7)
jobs, dirs = [], []
n_jobs = 4
for i in range(n_jobs):
sample = domain.sample()
# NOTE: this test might fail if /tmp is not shared in the slurm cluster.
# Adding the argument dir="/path/to/shared/dir" can fix that
dirs.append(tempfile.TemporaryDirectory())
jobs.append(SlurmJob(task="hypertunity/scheduling/tests/script.py",
args=(*sample.as_namedtuple(),),
output_file=f"{os.path.join(dirs[-1].name, 'results.pkl')}",
meta={"binary": "python", "resources": {"cpu": 1}}))
results = run_jobs(jobs)
astert all([r.data == script.main(*j.args) for r, j in zip(results, jobs)])
# clean-up the temporary dirs
for d in dirs:
d.cleanup()