ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.JobRunner.JobRunner Class Reference
Inheritance diagram for python.JobRunner.JobRunner:
Collaboration diagram for python.JobRunner.JobRunner:

Public Member Functions

def __init__ (self, **params)
 
def setParam (self, name, value=None, description=None, isSpecial=None, insertAtFront=False)
 
def appendParam (self, name, value=None, description=None, isSpecial=None, insertAtFront=False, endOfLine='\n')
 
def getParam (self, name)
 
def isSpecialParam (self, name)
 
def registerToBeCopied (self, paramName)
 
def checkParams (self)
 
def showParams (self, maxLineLength=80)
 
def dumpParams (self, format='%(name) -20s=%(value) s', maxLineLength=0)
 
def addFiles (self, fileList)
 
def addFilesToPoolFileCatalog (self, fileList)
 
def configureJob (self, jobnr, inputList=[])
 
def configure (self)
 
def submitJob (self, jobConfig)
 
def runJob (self, jobnr)
 
def run (self, jobnr=None)
 
def getNJobs (self)
 
def getRunningJobs (self)
 
def wait (self)
 
def getOutputFiles (self)
 
def log (self, subject, body, **data)
 

Public Attributes

 params
 
 paramOrder
 
 paramToBeCopied
 
 jobs
 
 jobStatus
 

Detailed Description

JobRunner base class

Definition at line 99 of file JobRunner.py.

Constructor & Destructor Documentation

◆ __init__()

def python.JobRunner.JobRunner.__init__ (   self,
**  params 
)
Constructor (takes any number of parameters as an argument).

Reimplemented in python.PandaJobRunner.PandaJobRunner, python.PDSFJobRunner.PDSFJobRunner, python.HTCondorJobRunner.HTCondorJobRunner, python.BackgroundJobRunner.BackgroundJobRunner, and python.ShellJobRunner.ShellJobRunner.

Definition at line 102 of file JobRunner.py.

102  def __init__(self,**params):
103  """Constructor (takes any number of parameters as an argument)."""
104  self.params = { } # Dictionary of JobRunnerParameter, indexed by parameter name
105  self.paramOrder = [ ] # Ordered list of parameter names
106  self.paramToBeCopied = [ ] # List of parameters specifying files to be copied before job starts
107  self.jobs = { } # Dictionary of job configuratinos (params), indexed by jobnr
108  self.jobStatus = { } # Dictionary of job exit status, indexed by jobnr
109 
110  # Job parameters (parameters flagged as special require specific code in configureJob)
111  self.setParam('jobnr',-1,'Number of job last configured',True)
112  self.setParam('inputfiles',[],'List of all input files',True)
113  self.setParam('filesperjob',1,'Number of input files per job')
114  self.setParam('lbperjob',0,'Number of luminosity blocks per job if doing LB bunching')
115  self.setParam('maxjobs',0,'Maximum number of jobs to run (0=no maximum)')
116  self.setParam('jobname','job%(jobnr)03i','Job name template')
117  self.setParam('jobdir',os.getcwd(),'Directory template from where the jobs are started')
118  self.setParam('rundir','.','Directory template where the jobs execute')
119  self.setParam('configfile','%(jobdir)s/%(jobname)s.config.py','Job configuration file name template (use %(jobnr)i for current job number)')
120  self.setParam('configmy','%(jobdir)s/configMy.py','Job configuration file for CA configuration')
121  self.setParam('logfile','%(jobdir)s/%(jobname)s.log','Log file name template')
122  self.setParam('scriptfile','%(jobdir)s/%(jobname)s.sh','Script file name template')
123  self.setParam('outputfileprefix','%(jobdir)s/%(jobname)s-','Output file name prefix template')
124  self.setParam('outputfilelist',[],'List of desired output files (w/o outputfileprefix)')
125  self.setParam('outputfilestring','','Generated comma-separated list of desired output files with full names',True)
126  self.setParam('filesforpoolcatalog',[],'Files to insert into POOL file catalog')
127  self.setParam('addinputtopoolcatalog',True,"Add job's input files to POOL file catalog?")
128  self.setParam('subflag','%(jobdir)s/%(jobname)s.status.SUBMITTED','Status flag template for submitted jobs')
129  self.setParam('runflag','%(jobdir)s/%(jobname)s.status.RUNNING','Status flag template for running jobs')
130  self.setParam('exitflag','"%(jobdir)s/%(jobname)s.exit.$status"','Status flag template to record athena exit status')
131  self.setParam('exitstatus','"%(jobdir)s/%(jobname)s.exitstatus.dat"','File with exit status value')
132  self.setParam('postprocflag','%(jobdir)s/%(jobname)s.status.POSTPROCESSING','Status flag template for jobs requiring postprocessing')
133  self.setParam('completedflag','%(jobdir)s/%(jobname)s.status.COMPLETED','Status flag template for completed jobs')
134  self.setParam('doneflag','','Actual status flag used at end of job',True)
135  self.setParam('logmail','','E-mail address for sending status e-mails')
136  self.setParam('release',GetRelease(),'Software release (may include flags such as opt,runtime)')
137  self.setParam('setuprelease',True,'Setup ATLAS software release?')
138  self.setParam('returnstatuscode',False,'Return athena status code from script?')
139  self.setParam('joboptionpath',os.getcwd()+'/joboptions.py','Master joboption file (w/full path if not in release)')
140  self.setParam('taskpostprocsteps','','Task-level postprocessing steps (defined at task submission)')
141  self.setParam('jobpostprocsteps','','Job-level postprocessing steps (updated by template)')
142  self.setParam('cmdsetup','','Statement for setting up release',True)
143  self.setParam('cmddefinepoolcatalog','','Statement for defining POOL file catalog',True)
144  self.setParam('cmdcopyfiles','','Statement to copy files to local directory',True)
145  self.setParam('cmdjobpreprocessing','','Statement(s) to execute for preprocessing',False)
146  self.setParam('cmdjobpostprocessing','','Statement(s) to execute for postprocessing',False)
147  self.setParam('cmdexit','','Statement used to exit shell script (allows passing up athena exit code)',True)
148  self.setParam('maketmpdir','mkdir -p tmp','Statement to create tmp directory')
149  self.setParam('script',scriptTemplate,'Template of job submission script',True)
150 
151  # Set additional parameters given to constructor
152  for k in params.keys():
153  self.setParam(k,params[k])
154 
155  self.checkParams()
156 
157 

Member Function Documentation

◆ addFiles()

def python.JobRunner.JobRunner.addFiles (   self,
  fileList 
)
Add a list of input files to be processed.

Definition at line 248 of file JobRunner.py.

248  def addFiles(self,fileList):
249  """ Add a list of input files to be processed."""
250  self.getParam('inputfiles').extend(fileList)
251 
252 

◆ addFilesToPoolFileCatalog()

def python.JobRunner.JobRunner.addFilesToPoolFileCatalog (   self,
  fileList 
)
Add a list of files to be inserted to the POOL file catalog.

Definition at line 253 of file JobRunner.py.

253  def addFilesToPoolFileCatalog(self,fileList):
254  """Add a list of files to be inserted to the POOL file catalog."""
255  self.getParam('filesforpoolcatalog').extend(fileList)
256 
257 

◆ appendParam()

def python.JobRunner.JobRunner.appendParam (   self,
  name,
  value = None,
  description = None,
  isSpecial = None,
  insertAtFront = False,
  endOfLine = '\n' 
)
Append to the value of a job parameter. If the parameter doesn't exist yet,
   setParam is called to create it. If it does exist, only the value is updated
   and the description and flag arguments are ignored.

Definition at line 178 of file JobRunner.py.

178  def appendParam(self,name,value=None,description=None,isSpecial=None,insertAtFront=False,endOfLine='\n'):
179  """Append to the value of a job parameter. If the parameter doesn't exist yet,
180  setParam is called to create it. If it does exist, only the value is updated
181  and the description and flag arguments are ignored."""
182  if name in self.params:
183  if value is not None:
184  p = self.params[name]
185  if isinstance(p.value,str) and p.value:
186  p.value = p.value + endOfLine + value
187  else:
188  p.value = p.value + value
189  else:
190  self.setParam(name,value,description,isSpecial,insertAtFront)
191 
192 

◆ checkParams()

def python.JobRunner.JobRunner.checkParams (   self)
A generic routine for checking job parameters. Check that all parameters
   can be evaluated. May be overrridden by a subclass if desired.

Definition at line 210 of file JobRunner.py.

210  def checkParams(self):
211  """A generic routine for checking job parameters. Check that all parameters
212  can be evaluated. May be overrridden by a subclass if desired."""
213  if len(self.paramOrder)!=len(self.params):
214  raise JobRunnerError ('Inconsistent parameter definition')
215  try:
216  tmp = { }
217  for p in self.paramOrder:
218  value = '' # this is necessary to prevent an exception from picking up the previous value
219  value = self.getParam(p)
220  if isinstance(value,str):
221  tmp[p] = value % tmp
222  else:
223  tmp[p] = value
224  except Exception:
225  raise JobRunnerError ('Unable to evaluate parameter: '+p+' = '+value+' (check parameter order)')
226 
227 

◆ configure()

def python.JobRunner.JobRunner.configure (   self)
Configure all jobs.

Definition at line 375 of file JobRunner.py.

375  def configure(self):
376  """Configure all jobs."""
377  if self.getParam('filesperjob')==0 or not self.getParam('inputfiles'):
378  raise JobRunnerError ("No input files or illegal parameter 'filesperjob'")
379  lbperjob = self.getParam('lbperjob')
380  if lbperjob:
381  # Bunched job submission with all files from LB range in single job
382  if lbperjob<=0:
383  raise JobRunnerError ('Negative number of luminosity blocks per job not allowed')
384  inputfiles = self.getParam('inputfiles')
385  jobInputDict = {}
386  jobLBDict = {}
387  lbpattern = re.compile(r'lb(\d+)')
388  for f in inputfiles:
389  lbnrs = lbpattern.findall(f)
390 
391  if(len(lbnrs) < 1) :
392  raise JobRunnerError ('Unable to determine luminosity block number of file %s' % f)
393 
394  if(len(lbnrs) > 2) :
395  raise JobRunnerError ('Too many luminosity block numbers in filename %s' % f)
396 
397  lbnr = int(lbnrs[0])
398  if(len(lbnrs) > 1) :
399  lbnrmax = int(lbnrs[1])
400  else :
401  lbnrmax = lbnr
402 
403  while (lbnr <= lbnrmax) :
404 
405  jobId = int((lbnr-1)/lbperjob)
406  #print ('LB = %4i jobid = %i' % (lbnr,jobId))
407  if jobId not in jobInputDict:
408  jobInputDict[jobId] = [f]
409  jobLBDict[jobId] = [lbnr]
410  else:
411  if f not in jobInputDict[jobId] :
412  jobInputDict[jobId].append(f)
413  if lbnr not in jobLBDict[jobId] :
414  jobLBDict[jobId].append(lbnr)
415 
416  lbnr = lbnr+1
417 
418  maxJobs = self.getParam('maxjobs')
419  if not maxJobs:
420  maxJobs = len(jobInputDict)
421  for i in sorted(jobInputDict.keys())[:maxJobs]:
422  if i<0:
423  jobnr = 0
424  else:
425  jobnr = i*lbperjob+1 # use first LB number as job number
426  self.setParam('lbList', jobLBDict[i])
427  self.configureJob(jobnr,jobInputDict[i])
428 
429  else:
430  # Normal (unbunched job submission)
431  njobs = int(math.ceil(float(len(self.getParam('inputfiles')))/self.getParam('filesperjob')))
432  if self.getParam('maxjobs'):
433  njobs = min(self.getParam('maxjobs'),njobs)
434  print ('\nConfiguring %i job(s) ...' % (njobs))
435  for i in range(njobs):
436  self.configureJob(i)
437 
438 

◆ configureJob()

def python.JobRunner.JobRunner.configureJob (   self,
  jobnr,
  inputList = [] 
)
Configure parameters for a single job and write job configuration files. If inputLIst
   is given, this is the list of input files used for the job.

Definition at line 258 of file JobRunner.py.

258  def configureJob(self,jobnr,inputList=[]):
259  """Configure parameters for a single job and write job configuration files. If inputLIst
260  is given, this is the list of input files used for the job."""
261  if jobnr in self.jobs:
262  raise JobRunnerError ('Job number %s already configured' % jobnr)
263  jobConfig = { }
264 
265  jobConfig['jobnr'] = jobnr
266  self.setParam('jobnr',jobnr)
267 
268  # Check if any input files are available for this job
269  if inputList:
270  jobConfig['inputfiles'] = inputList
271  else:
272  inputfiles = self.getParam('inputfiles')
273  iFirst = self.getParam('filesperjob')*jobnr
274  if iFirst >= len(inputfiles):
275  raise JobRunnerError ('Jobnr = %i too high for available number of files' % jobnr)
276  iLast = iFirst + self.getParam('filesperjob')
277  if iLast > len(inputfiles):
278  iLast=len(inputfiles)
279  jobConfig['inputfiles'] = inputfiles[iFirst:iLast]
280 
281  # Update regular parameters
282  for p in self.paramOrder:
283  if self.isSpecialParam(p): continue
284  value = self.getParam(p)
285  if isinstance(value,str):
286  jobConfig[p] = value % jobConfig
287  else:
288  jobConfig[p] = value
289 
290  # Define statement to set up the release
291  if jobConfig['setuprelease']:
292  # Use explicit command if given
293  jobConfig['cmdsetup'] = self.getParam('cmdsetup') % jobConfig
294  # otherwise take from CMDSETUP env var if set or assume normal asetup
295  if not jobConfig['cmdsetup']:
296  jobConfig['cmdsetup'] = os.getenv('CMDSETUP','source /afs/cern.ch/atlas/software/dist/AtlasSetup/scripts/asetup.sh %(release)s --noautocdtest') % jobConfig
297  else:
298  jobConfig['cmdsetup'] = ''
299 
300  # Collect files to be copied locally, and replace corresponding jobConfig
301  # parameters by base file name (to point to the local copy)
302  jobConfig['cmdcopyfiles'] = self.getParam('cmdcopyfiles') % jobConfig
303  if not jobConfig['cmdcopyfiles']:
304  filestobecopied = ''
305  for p in self.paramToBeCopied:
306  if not jobConfig[p]: continue
307  filestobecopied = ' '.join([filestobecopied,jobConfig[p]])
308  jobConfig[p] = os.path.basename(jobConfig[p])
309  if filestobecopied:
310  jobConfig['cmdcopyfiles'] = 'cp -p '+filestobecopied+' .'
311 
312  # Unless the user sets a specific value for parameter cmddefinepoolcatalog, determine
313  # what should be added and create appropriate catalog
314  jobConfig['cmddefinepoolcatalog'] = self.getParam('cmddefinepoolcatalog') % jobConfig
315  if not jobConfig['cmddefinepoolcatalog']:
316  if jobConfig['addinputtopoolcatalog']:
317  argstring = ' '.join(jobConfig['filesforpoolcatalog']+jobConfig['inputfiles']) % jobConfig
318  else:
319  argstring = ' '.join(jobConfig['filesforpoolcatalog']) % jobConfig
320  if argstring:
321  jobConfig['cmddefinepoolcatalog'] = 'pool_insertFileToCatalog '+argstring
322 
323  # Define statement used to exit the shell script
324  if jobConfig['returnstatuscode']:
325  jobConfig['cmdexit'] = self.getParam('cmdexit') % jobConfig
326  if not jobConfig['cmdexit']:
327  jobConfig['cmdexit'] = 'exit $status' % jobConfig
328  else:
329  jobConfig['cmdexit'] = ''
330 
331  # Generate string with comma-separated list of output files with full name
332  jobConfig['outputfilestring'] = ','.join([jobConfig['outputfileprefix']+f for f in jobConfig['outputfilelist']])
333 
334  # Update remaining special parameters
335  if jobConfig['taskpostprocsteps']:
336  jobConfig['doneflag'] = jobConfig['postprocflag']
337  else:
338  jobConfig['doneflag'] = jobConfig['completedflag']
339  jobConfig['script'] = self.getParam('script') % jobConfig
340 
341  # Check if job's output files exist already in order to prevent overwriting of data
342  # NOTE: cannot just check for existence of jobdir, since this might be set to the
343  # current directory
344  for f in jobConfig['outputfilelist']:
345  if os.access(jobConfig['outputfileprefix']+f,os.F_OK):
346  raise JobRunnerError ('Job output file %s exists already' % jobConfig[f])
347  for f in ('configfile', 'scriptfile', 'logfile'):
348  if os.access(jobConfig[f],os.F_OK):
349  raise JobRunnerError ('Job configuration or log file %s exists already' % jobConfig[f])
350 
351  # Make sure start directory where script and config files will be written to exists
352  os.makedirs('%(jobdir)s' % jobConfig)
353 
354  # Write job configuration file
355  config = open(jobConfig['configfile'],'w')
356  config.write('# Job configuration data for job %(jobname)s\n' % jobConfig)
357  config.write('# Generated by JobRunner.py\n\n')
358  if pprint.isreadable(jobConfig):
359  config.write('jobConfig = '+pprint.pformat(jobConfig))
360  else:
361  config.write('jobConfig = '+repr(jobConfig))
362  config.write('\n')
363  config.close()
364 
365  # Write script file
366  script = open(jobConfig['scriptfile'],'w')
367  script.write(jobConfig['script'])
368  script.close()
369  os.chmod(jobConfig['scriptfile'],0o755)
370 
371  # Record job configuration
372  self.jobs[jobnr] = jobConfig
373 
374 

◆ dumpParams()

def python.JobRunner.JobRunner.dumpParams (   self,
  format = '%(name)-20s = %(value)s',
  maxLineLength = 0 
)
Dump all parameters into a string in a user-specified format.

Definition at line 237 of file JobRunner.py.

237  def dumpParams(self,format='%(name)-20s = %(value)s',maxLineLength=0): """Dump all parameters into a string in a user-specified format."""
238  dump = ''
239  for p in self.paramOrder:
240  s = format % self.params[p].__dict__
241  if maxLineLength:
242  s = s[0:maxLineLength-3]+'...'
243  dump += s+'\n'
244  return dump
245 
246 
247 

◆ getNJobs()

def python.JobRunner.JobRunner.getNJobs (   self)

Definition at line 477 of file JobRunner.py.

477  def getNJobs(self):
478  if not self.jobs:
479  return 0
480  else:
481  return len(self.jobs)
482 
483 

◆ getOutputFiles()

def python.JobRunner.JobRunner.getOutputFiles (   self)
Get a list of all output files.

Definition at line 504 of file JobRunner.py.

504  def getOutputFiles(self):
505  """Get a list of all output files."""
506  outputFiles = [ ]
507  for j in self.jobs:
508  for f in sorted(glob.glob(self.jobs[j]['outputfileprefix']+'*')):
509  outputFiles.append(f)
510  return outputFiles
511 
512 

◆ getParam()

def python.JobRunner.JobRunner.getParam (   self,
  name 
)
Get value of a parameter by name.

Definition at line 193 of file JobRunner.py.

193  def getParam(self,name):
194  """Get value of a parameter by name."""
195  return self.params[name].value
196 
197 

◆ getRunningJobs()

def python.JobRunner.JobRunner.getRunningJobs (   self)
Get list of jobs submitted by this JobRunner that are still running

Definition at line 484 of file JobRunner.py.

484  def getRunningJobs(self):
485  """Get list of jobs submitted by this JobRunner that are still running"""
486  runningJobs = [ ]
487  for j in self.jobs:
488  if os.path.exists(self.jobs[j]['subflag']) or os.path.exists(self.jobs[j]['runflag']):
489  runningJobs.append(self.jobs[j]['jobname'])
490  return runningJobs
491 
492 

◆ isSpecialParam()

def python.JobRunner.JobRunner.isSpecialParam (   self,
  name 
)
Check if parameter requires special treatment.

Definition at line 198 of file JobRunner.py.

198  def isSpecialParam(self,name):
199  """Check if parameter requires special treatment."""
200  return self.params[name].isSpecial
201 
202 

◆ log()

def python.JobRunner.JobRunner.log (   self,
  subject,
  body,
**  data 
)
Send a log message to a set of users specified by parameter 'logmail'.

Definition at line 513 of file JobRunner.py.

513  def log(self,subject,body,**data):
514  """Send a log message to a set of users specified by parameter 'logmail'."""
515  if self.getParam('logmail'):
516  msg = 'Generated by JobRunner on host '+socket.gethostname()+' by '+pwd.getpwuid(os.getuid())[0]+' at '+time.asctime()
517  msg += '\n\nCurrent working directory = '+os.getcwd()
518  if body: msg += '\n\n'+body
519  for k in data.keys():
520  if isinstance(data[k],dict):
521  msg += "\n\n%s:" % k
522  items = data[k].keys()
523  items.sort()
524  for i in items:
525  msg += "\n %-20s = %s" % (i,data[k][i])
526  else:
527  msg += "\n\n%-20s = %s" % (k,data[k])
528  subprocess.call("echo '%s' | mail -s '%s' '%s'" %
529  (msg,subject,self.getParam('logmail')), shell=True)
530 
531 
532 #
533 # Test code
534 #

◆ registerToBeCopied()

def python.JobRunner.JobRunner.registerToBeCopied (   self,
  paramName 
)
Register a parameter holding the name of an input file to be
   copied before a job starts.

Definition at line 203 of file JobRunner.py.

203  def registerToBeCopied(self,paramName):
204  """Register a parameter holding the name of an input file to be
205  copied before a job starts."""
206  if paramName not in self.paramToBeCopied:
207  self.paramToBeCopied.append(paramName)
208 
209 

◆ run()

def python.JobRunner.JobRunner.run (   self,
  jobnr = None 
)
Run all configured job(s)

Definition at line 466 of file JobRunner.py.

466  def run(self,jobnr=None):
467  """Run all configured job(s)"""
468  if not self.jobs:
469  raise JobRunnerError ('No configured jobs')
470  njobs = len(self.jobs)
471  self.log('JobRunner: starting '+str(njobs)+' jobs',self.dumpParams())
472  for j in sorted(self.jobs.keys()):
473  print ('\nStarting job %i (using %s) ...\n' % (j,self.__class__))
474  self.runJob(j)
475 
476 

◆ runJob()

def python.JobRunner.JobRunner.runJob (   self,
  jobnr 
)
Run a single configured job.

Definition at line 456 of file JobRunner.py.

456  def runJob(self,jobnr):
457  """Run a single configured job."""
458  if jobnr not in self.jobs:
459  raise JobRunnerError ('Job number %s is not configured' % jobnr)
460  jobConfig = self.jobs[jobnr]
461  subprocess.call('touch '+jobConfig['subflag'], shell=True)
462  status = self.submitJob(jobConfig)
463  self.jobStatus[jobnr] = status
464 
465 

◆ setParam()

def python.JobRunner.JobRunner.setParam (   self,
  name,
  value = None,
  description = None,
  isSpecial = None,
  insertAtFront = False 
)
Set the value of a job parameter. Job parameters may be templates that name
   previously defined job parameters and will be evaluated when a given job
   is configured. Therefore the order in which setParam is called for the different
   parameters is relevant. insertAtFront can be set to True to force early
   evaluation of a given parameter.

Definition at line 158 of file JobRunner.py.

158  def setParam(self,name,value=None,description=None,isSpecial=None,insertAtFront=False):
159  """Set the value of a job parameter. Job parameters may be templates that name
160  previously defined job parameters and will be evaluated when a given job
161  is configured. Therefore the order in which setParam is called for the different
162  parameters is relevant. insertAtFront can be set to True to force early
163  evaluation of a given parameter."""
164  p = self.params[name] = self.params.get(name,JobRunnerParameter(name))
165  if value is not None:
166  p.value = value
167  if description is not None:
168  p.description = description
169  if isSpecial is not None:
170  p.isSpecial=isSpecial
171  if name not in self.paramOrder:
172  if insertAtFront:
173  self.paramOrder.insert(0,name)
174  else:
175  self.paramOrder.append(name)
176 
177 

◆ showParams()

def python.JobRunner.JobRunner.showParams (   self,
  maxLineLength = 80 
)
Show current job parameters.

Definition at line 228 of file JobRunner.py.

228  def showParams(self,maxLineLength=80):
229  """Show current job parameters."""
230  for p in self.paramOrder:
231  s = str(self.params[p])
232  if maxLineLength > 0 and len(s) > maxLineLength:
233  s = s[0:maxLineLength-3] + '...'
234  print (s)
235 
236 

◆ submitJob()

def python.JobRunner.JobRunner.submitJob (   self,
  jobConfig 
)
This method is to be overridden by dervied JobRunner classes. This default
   implementation in the JobRunner base class runs jobs directly, printing the
   output onto the termminal. If a specific implementation of submitJob directly
   runs a job, it should return the exit status of the job. If it only submits the
   job, the status should be returned as None.

Reimplemented in python.PandaJobRunner.PandaJobRunner, python.PDSFJobRunner.PDSFJobRunner, python.HTCondorJobRunner.HTCondorJobRunner, python.BackgroundJobRunner.BackgroundJobRunner, and python.ShellJobRunner.ShellJobRunner.

Definition at line 439 of file JobRunner.py.

439  def submitJob(self,jobConfig):
440  """This method is to be overridden by dervied JobRunner classes. This default
441  implementation in the JobRunner base class runs jobs directly, printing the
442  output onto the termminal. If a specific implementation of submitJob directly
443  runs a job, it should return the exit status of the job. If it only submits the
444  job, the status should be returned as None."""
445  scriptfile = jobConfig['scriptfile']
446  logfile = jobConfig['logfile']
447  exitstatus = jobConfig['exitstatus']
448  # Write only to standard output, don't produce log file
449  #status = subprocess.call(scriptfile, shell=True) >> 8 # Convert to standard Unix exit code
450  # Write to both stdout and log file, preserve exit status code
451  status = subprocess.call('%s 2>&1 | tee %s ; exit `cat %s`'
452  % (scriptfile,logfile,exitstatus), shell=True) >> 8 # Convert to standard Unix exit code
453  return status
454 
455 

◆ wait()

def python.JobRunner.JobRunner.wait (   self)
Wait until all jobs have completed

Definition at line 493 of file JobRunner.py.

493  def wait(self):
494  """Wait until all jobs have completed"""
495  while 1:
496  time.sleep(30)
497  runningJobs = self.getRunningJobs()
498  if not runningJobs: break
499  print()
500  print (time.asctime(),' Waiting for %2s job(s) (%s)' % (len(runningJobs),runningJobs))
501  self.log('JobRunner: finished',self.dumpParams(),outputFiles=self.getOutputFiles())
502 
503 

Member Data Documentation

◆ jobs

python.JobRunner.JobRunner.jobs

Definition at line 107 of file JobRunner.py.

◆ jobStatus

python.JobRunner.JobRunner.jobStatus

Definition at line 108 of file JobRunner.py.

◆ paramOrder

python.JobRunner.JobRunner.paramOrder

Definition at line 105 of file JobRunner.py.

◆ params

python.JobRunner.JobRunner.params

Definition at line 104 of file JobRunner.py.

◆ paramToBeCopied

python.JobRunner.JobRunner.paramToBeCopied

Definition at line 106 of file JobRunner.py.


The documentation for this class was generated from the following file:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
configure
bool configure(asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > &tool, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronEffToolsHandles, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronSFToolsHandles, ToolHandleArray< CP::IMuonTriggerScaleFactors > &muonToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonEffToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonSFToolsHandles, const std::string &triggers, const std::map< std::string, std::string > &legsPerTool, unsigned long nToys, bool debug)
Definition: TrigGlobEffCorrValidation.cxx:514
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
PyAthena::repr
std::string repr(PyObject *o)
returns the string representation of a python object equivalent of calling repr(o) in python
Definition: PyAthenaUtils.cxx:106
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Trk::open
@ open
Definition: BinningType.h:40
ActsTrk::detail::MakeDerivedVariant::extend
constexpr std::variant< Args..., T > extend(const std::variant< Args... > &, const T &)
Definition: MakeDerivedVariant.h:17
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
readCCLHist.float
float
Definition: readCCLHist.py:83
python.JobRunner.GetRelease
def GetRelease()
Definition: JobRunner.py:88