@@ -313,7 +313,13 @@ def getJobStatus(self, **kwargs):
313313 resultDict ["Message" ] = "No user name"
314314 return resultDict
315315
316- cmd = "condor_q -submitter %s -af:j JobStatus HoldReasonCode HoldReasonSubCode HoldReason" % user
316+ #https://htcondor.readthedocs.io/en/latest/man-pages/condor_q.html
317+ # As of version 8.5.2, condor_q defaults to querying only the current user’s jobs.
318+ # This default is overridden when the restriction list has usernames and/or job ids,
319+ # when the -submitter or -allusers arguments are specified,
320+ # or when the current user is a queue superuser.
321+ # It can also be overridden by setting the CONDOR_Q_ONLY_MY_JOBS configuration macro to False.
322+ cmd = "condor_q -af:j JobStatus HoldReasonCode HoldReasonSubCode HoldReason"
317323 sp = subprocess .Popen (
318324 shlex .split (cmd ),
319325 stdout = subprocess .PIPE ,
@@ -330,8 +336,10 @@ def getJobStatus(self, **kwargs):
330336
331337 qList = output .strip ().split ("\n " )
332338
339+ # The condor_history command also has some slight modifications. The submitter option
340+ # is no more and user is just issued before the formatting.
333341 condorHistCall = (
334- "condor_history -af:j JobStatus HoldReasonCode HoldReasonSubCode HoldReason -submitter %s " % user
342+ "condor_history %s -af:j JobStatus HoldReasonCode HoldReasonSubCode HoldReason" % user
335343 )
336344 sp = subprocess .Popen (
337345 shlex .split (condorHistCall ),
@@ -371,9 +379,15 @@ def getCEStatus(self, **kwargs):
371379
372380 waitingJobs = 0
373381 runningJobs = 0
374-
382+
383+ #https://htcondor.readthedocs.io/en/latest/man-pages/condor_q.html
384+ # As of version 8.5.2, condor_q defaults to querying only the current user’s jobs.
385+ # This default is overridden when the restriction list has usernames and/or job ids,
386+ # when the -submitter or -allusers arguments are specified,
387+ # or when the current user is a queue superuser.
388+ # It can also be overridden by setting the CONDOR_Q_ONLY_MY_JOBS configuration macro to False.
375389 sp = subprocess .Popen (
376- shlex . split ( "condor_q -submitter %s" % user ) ,
390+ "condor_q" ,
377391 stdout = subprocess .PIPE ,
378392 stderr = subprocess .PIPE ,
379393 universal_newlines = True ,
@@ -400,12 +414,17 @@ def getCEStatus(self, **kwargs):
400414 if output :
401415 lines = output .split ("\n " )
402416 for line in lines :
403- if not line .strip ():
417+ tokens = line .split ()
418+ #Skip head and footer lines
419+ if (len (tokens ) == 0 ) or (len (tokens ) < 9 ):
404420 continue
405- if " I " in line :
421+ if tokens [ 7 ] == '1' :
406422 waitingJobs += 1
407- elif " R " in line :
423+ elif tokens [ 6 ] == '1' :
408424 runningJobs += 1
425+ elif tokens [8 ] == '1' :
426+ waitingJobs += 1
427+
409428
410429 # Final output
411430 resultDict ["Status" ] = 0
0 commit comments