@@ -60,10 +60,48 @@ def test_priority(self):
6060 job_id = stdout .split (" " )[- 1 ]
6161
6262 time .sleep (0.25 )
63- process = Popen ("squeue -u $USER -O qos" , stdout = PIPE , stderr = PIPE , shell = True )
63+ process = Popen ("squeue -u $USER -j {} - O qos" . format ( job_id ) , stdout = PIPE , stderr = PIPE , shell = True )
6464 stdout , stderr = process .communicate ()
6565 job_priorities = [prio .strip () for prio in stdout .split ("\n " )[1 :] if prio != '' ]
66- assert_true (all (prio == priority for prio in job_priorities ))
66+ assert_true (all (pri == priority for pri in job_priorities ))
67+
68+ def test_gres (self ):
69+ gress = ['gpu' , 'gpu:titanblack' ]
70+ for gres in gress :
71+ string = pbs_string .format (
72+ "#PBS -l gpu={gres}" .format (gres = gres )
73+ )
74+ with open ("test.pbs" , "w" ) as text_file :
75+ text_file .write (string )
76+ process = Popen ("sbatch test.pbs" , stdout = PIPE , stderr = PIPE , shell = True )
77+ stdout , stderr = process .communicate ()
78+ assert_true ("Submitted batch job" in stdout )
79+ job_id = stdout .split (" " )[- 1 ]
80+
81+ time .sleep (0.25 )
82+ process = Popen ("squeue -u $USER -j {} -O gres" .format (job_id ), stdout = PIPE , stderr = PIPE , shell = True )
83+ stdout , stderr = process .communicate ()
84+ job_gres = [gre .strip () for gre in stdout .split ("\n " )[1 :] if gre != '' ]
85+ assert_true (all (gpu == gres for gpu in job_gres ))
86+
87+ def test_memory (self ):
88+ mems = ['2G' , '4G' ]
89+ for mem in mems :
90+ string = pbs_string .format (
91+ "#PBS -l mem_free={memory}" .format (memory = mem )
92+ )
93+ with open ("test.pbs" , "w" ) as text_file :
94+ text_file .write (string )
95+ process = Popen ("sbatch test.pbs" , stdout = PIPE , stderr = PIPE , shell = True )
96+ stdout , stderr = process .communicate ()
97+ assert_true ("Submitted batch job" in stdout )
98+ job_id = stdout .split (" " )[- 1 ]
99+
100+ time .sleep (0.25 )
101+ process = Popen ("squeue -u $USER -j {} -O minmemory" .format (job_id ), stdout = PIPE , stderr = PIPE , shell = True )
102+ stdout , stderr = process .communicate ()
103+ job_mems = [m .strip () for m in stdout .split ("\n " )[1 :] if m != '' ]
104+ assert_true (all (me == mem for me in job_mems ))
67105
68106 # def test_pbs_slurm(self):
69107 # priorities = ['unkillable', 'high', 'low']
0 commit comments