@@ -104,6 +104,9 @@ def minimal_job(make_job, launcher):
104104
105105def test_run_command (job ):
106106 launcher_name = type (job .launcher ).registered_name
107+ # This is relevant only for the srun launcher, because it may
108+ # run in different platforms with older versions of Slurm
109+ job .launcher .use_cpus_per_task = True
107110 command = job .launcher .run_command (job )
108111 if launcher_name == 'alps' :
109112 assert command == 'aprun -n 4 -N 2 -d 2 -j 0 --foo'
@@ -116,7 +119,7 @@ def test_run_command(job):
116119 elif launcher_name == 'mpirun' :
117120 assert command == 'mpirun -np 4 --foo'
118121 elif launcher_name == 'srun' :
119- assert command == 'srun --foo'
122+ assert command == 'srun --cpus-per-task=2 -- foo'
120123 elif launcher_name == 'srunalloc' :
121124 assert command == ('srun '
122125 '--job-name=fake_job '
@@ -147,6 +150,9 @@ def test_run_command(job):
147150
148151def test_run_command_minimal (minimal_job ):
149152 launcher_name = type (minimal_job .launcher ).registered_name
153+ # This is relevant only for the srun launcher, because it may
154+ # run in different platforms with older versions of Slurm
155+ minimal_job .launcher .use_cpus_per_task = True
150156 command = minimal_job .launcher .run_command (minimal_job )
151157 if launcher_name == 'alps' :
152158 assert command == 'aprun -n 1 --foo'
0 commit comments