Skip to content

Commit dfa1391

Browse files
committed
Additional tests for JobGenerator
1 parent 1779a4f commit dfa1391

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

smartdispatch/tests/test_job_generator.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,28 @@ def test_generate_pbs4_cpu(self):
6464
# Check if needed modules for this queue are included in the PBS file
6565
assert_equal(job_generator.pbs_list[0].modules, self.modules)
6666

67+
def test_generate_pbs2_mem(self):
68+
# Should need two PBS file
69+
command_params = {'mem_per_command': self.mem_per_node // 2}
70+
job_generator = JobGenerator(self.queue, self.commands, command_params)
71+
assert_equal(len(job_generator.pbs_list), 2)
72+
assert_equal(job_generator.pbs_list[0].commands, self.commands[:2])
73+
assert_equal(job_generator.pbs_list[1].commands, self.commands[2:])
74+
75+
def test_generate_pbs4_mem(self):
76+
# Should needs four PBS file
77+
command_params = {'mem_per_command': self.mem_per_node}
78+
job_generator = JobGenerator(self.queue, self.commands, command_params)
79+
assert_equal(len(job_generator.pbs_list), 4)
80+
assert_equal([pbs.commands[0] for pbs in job_generator.pbs_list], self.commands)
81+
82+
# Since queue has no gpus it should not be specified in PBS resource `nodes`
83+
assert_true('gpus' not in job_generator.pbs_list[0].resources['nodes'])
84+
85+
# Test modules to load
86+
# Check if needed modules for this queue are included in the PBS file
87+
assert_equal(job_generator.pbs_list[0].modules, self.modules)
88+
6789
def test_generate_pbs2_gpu(self):
6890
# Test nb_gpus_per_command argument
6991
# Should needs two PBS file

0 commit comments

Comments
 (0)