@@ -391,7 +391,7 @@ def __init__(self, workflowfile, args, jmax=100):
391391 self .pid_to_connections = {} # we can auto-detect what connections are opened by which task (at least to some extent)
392392 signal .signal (signal .SIGINT , self .SIGHandler )
393393 signal .siginterrupt (signal .SIGINT , False )
394- self .nicevalues = [ 0 for tid in range (len (self .taskuniverse )) ]
394+ self .nicevalues = [ os . nice ( 0 ) for tid in range (len (self .taskuniverse )) ]
395395 self .internalmonitorcounter = 0
396396
397397 def SIGHandler (self , signum , frame ):
@@ -449,7 +449,7 @@ def remove_done_flag(self, listoftaskids):
449449 os .remove (done_filename )
450450
451451 # submits a task as subprocess and records Popen instance
452- def submit (self , tid , nice = 0 ):
452+ def submit (self , tid , nice = os . nice ( 0 ) ):
453453 actionlogger .debug ("Submitting task " + str (self .idtotask [tid ]) + " with nice value " + str (nice ))
454454 c = self .workflowspec ['stages' ][tid ]['cmd' ]
455455 workdir = self .workflowspec ['stages' ][tid ]['cwd' ]
@@ -477,7 +477,7 @@ def submit(self, tid, nice=0):
477477 self .nicevalues [tid ]= nice
478478 except (psutil .NoSuchProcess , psutil .AccessDenied ):
479479 actionlogger .error ('Couldn\' t set nice value of ' + str (p .pid ) + ' to ' + str (nice ) + ' -- current value is ' + str (p .nice ()))
480- self .nicevalues [tid ]= 0
480+ self .nicevalues [tid ]= os . nice ( 0 )
481481 return p
482482
483483 def ok_to_submit (self , tid , backfill = False ):
@@ -635,7 +635,7 @@ def monitor(self, process_list):
635635 metriclogger .info (resources_per_task [tid ])
636636
637637 for r in resources_per_task .values ():
638- if r ['nice' ]== 0 :
638+ if r ['nice' ]== os . nice ( 0 ) :
639639 globalCPU += r ['cpu' ]
640640 globalPSS += r ['pss' ]
641641 else :
0 commit comments