Skip to content

Commit

Permalink
Merge pull request #161 from pyiron/slurm_test
Browse files Browse the repository at this point in the history
Add slurm squeue test
  • Loading branch information
jan-janssen authored Apr 19, 2023
2 parents 9045444 + fa4dc6d commit e11ebc3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/config/slurm/squeue_output
Original file line number Diff line number Diff line change
@@ -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
28 changes: 27 additions & 1 deletion tests/test_queueadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_sge(self):
with open(os.path.join(self.path, "config/sge", "qstat.xml"), "r") as f:
content = f.read()
Expand Down Expand Up @@ -270,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"],
Expand Down

0 comments on commit e11ebc3

Please sign in to comment.