From 97f08e9c2fecc91676ba9dd375e8aecb56c8e38f Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Wed, 19 Apr 2023 09:16:36 -0600 Subject: [PATCH 1/2] Add slurm squeue test --- tests/config/slurm/squeue_output | 5 +++++ tests/test_queueadapter.py | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/config/slurm/squeue_output diff --git a/tests/config/slurm/squeue_output b/tests/config/slurm/squeue_output new file mode 100644 index 00000000..5d1b44b9 --- /dev/null +++ b/tests/config/slurm/squeue_output @@ -0,0 +1,5 @@ +5322019|janj|R|pi_19576488|/cmmc/u/janj/pyiron/projects/2023/2023-04-19-dft-test/job_1 +5322016|janj|R|pi_19576485|/cmmc/u/janj/pyiron/projects/2023/2023-04-19-dft-test/job_2 +5322017|janj|R|pi_19576486|/cmmc/u/janj/pyiron/projects/2023/2023-04-19-dft-test/job_3 +5322018|janj|R|pi_19576487|/cmmc/u/janj/pyiron/projects/2023/2023-04-19-dft-test/job_4 +5322013|janj|R|pi_19576482|/cmmc/u/janj/pyiron/projects/2023/2023-04-19-dft-test/job_5 \ No newline at end of file diff --git a/tests/test_queueadapter.py b/tests/test_queueadapter.py index 7f5e81e6..91e2fcae 100644 --- a/tests/test_queueadapter.py +++ b/tests/test_queueadapter.py @@ -228,6 +228,32 @@ def test__list_command_to_be_executed(self): "here", ) + def test_convert_queue_status_slurm(self): + with open(os.path.join(self.path, "config/slurm", "squeue_output"), "r") as f: + content = f.read() + df_verify = pandas.DataFrame( + { + "jobid": [5322019, 5322016, 5322017, 5322018, 5322013], + "user": ["janj", "janj", "janj", "janj", "janj"], + "jobname": ["pi_19576488", "pi_19576485", "pi_19576486", "pi_19576487", "pi_19576482"], + "status": ["running", "running", "running", "running", "running"], + "working_directory": [ + "/cmmc/u/janj/pyiron/projects/2023/2023-04-19-dft-test/job_1", + "/cmmc/u/janj/pyiron/projects/2023/2023-04-19-dft-test/job_2", + "/cmmc/u/janj/pyiron/projects/2023/2023-04-19-dft-test/job_3", + "/cmmc/u/janj/pyiron/projects/2023/2023-04-19-dft-test/job_4", + "/cmmc/u/janj/pyiron/projects/2023/2023-04-19-dft-test/job_5", + ] + } + ) + self.assertTrue( + df_verify.equals( + self.slurm._adapter._commands.convert_queue_status( + queue_status_output=content + ) + ) + ) + def test_convert_queue_status(self): with open(os.path.join(self.path, "config/sge", "qstat.xml"), "r") as f: content = f.read() From fa4dc6dc21222f8c7166239c1da54144b9f79d9c Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Wed, 19 Apr 2023 10:35:42 -0600 Subject: [PATCH 2/2] Fix broken test --- tests/test_queueadapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_queueadapter.py b/tests/test_queueadapter.py index 4924ac9b..76f0f4d2 100644 --- a/tests/test_queueadapter.py +++ b/tests/test_queueadapter.py @@ -296,7 +296,7 @@ def test_convert_queue_status_torque(self): content = f.read() df_verify = pandas.DataFrame( { - "jobid": ["80005196", "80005197", "80005198"], + "jobid": [80005196, 80005197, 80005198], "user": ["asd562", "asd562", "fgh562"], "jobname": ["test1", "test2", "test_asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf"], "status": ["running", "pending", "pending"],