From 651e54d567b6c0d75e3b66da025f6e648b257861 Mon Sep 17 00:00:00 2001 From: Aditya Agarwal <50960175+adi611@users.noreply.github.com> Date: Wed, 29 Mar 2023 18:27:38 +0530 Subject: [PATCH 1/2] add tests for --error and --output sbatch_args --- pydra/engine/tests/test_submitter.py | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/pydra/engine/tests/test_submitter.py b/pydra/engine/tests/test_submitter.py index 49b10c2b2..376d0dde4 100644 --- a/pydra/engine/tests/test_submitter.py +++ b/pydra/engine/tests/test_submitter.py @@ -299,6 +299,40 @@ def test_slurm_args_2(tmpdir): sub(task) +@need_slurm +def test_slurm_args_3(tmpdir): + """testing sbatch_args provided to the submitter + test should pass when valid error sbatch_args is provided + """ + task = sleep_add_one(x=1) + task.cache_dir = tmpdir + # submit workflow and every task as slurm job + with Submitter("slurm", sbatch_args="--error=error.log") as sub: + sub(task) + + res = task.result() + assert res.output.out == 2 + error_log_file = tmpdir / "SlurmWorker_scripts" + assert error_log_file.exists() + + +@need_slurm +def test_slurm_args_4(tmpdir): + """testing sbatch_args provided to the submitter + test should pass when valid output sbatch_args is provided + """ + task = sleep_add_one(x=1) + task.cache_dir = tmpdir + # submit workflow and every task as slurm job + with Submitter("slurm", sbatch_args="--output=output.log") as sub: + sub(task) + + res = task.result() + assert res.output.out == 2 + output_log_file = tmpdir / "SlurmWorker_scripts" + assert output_log_file.exists() + + @mark.task def sleep(x, job_name_part): time.sleep(x) From 0acb8a7a398ff881a474e9f636be6a0e62fff4b3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 Mar 2023 13:12:23 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pydra/engine/tests/test_submitter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydra/engine/tests/test_submitter.py b/pydra/engine/tests/test_submitter.py index 376d0dde4..12d208242 100644 --- a/pydra/engine/tests/test_submitter.py +++ b/pydra/engine/tests/test_submitter.py @@ -319,7 +319,7 @@ def test_slurm_args_3(tmpdir): @need_slurm def test_slurm_args_4(tmpdir): """testing sbatch_args provided to the submitter - test should pass when valid output sbatch_args is provided + test should pass when valid output sbatch_args is provided """ task = sleep_add_one(x=1) task.cache_dir = tmpdir