ATLAS Offline Software
HTCondorJobRunner.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4 
5 
6 """
7 HTCondorJobRunner is a JobRunner for running jobs with the HTCondor batch system.
8 
9 Written by Anthony Morley in 2019.
10 """
11 __author__ = 'Anthony Morley'
12 __version__ = '$Id: HTCondorJobRunner.py 216126 2009-09-29 16:12:59Z atlidbs $'
13 
14 
15 from InDetBeamSpotExample import JobRunner
16 import os
17 
18 condorScriptTemplate="""executable = %(scriptfile)s
19 arguments = $(ClusterID) $(ProcId)
20 output = %(logfile)s.out
21 error = %(logfile)s.err
22 log = %(logfile)s.log
23 universe = vanilla
24 +JobFlavour = %(batchqueue)s
25 queue
26 """
27 
29  """HTCondorJobRunner - run jobs using the HTCondor batch system"""
30 
31  def __init__(self,**params):
32  """Constructor (takes any number of parameters as an argument)."""
33  JobRunner.JobRunner.__init__(self)
34 
35  # Set user-specified parameters only after HTCondorJobRunner defaults
36  self.setParam('batchqueue','workday','Batch queue')
37  for k in params.keys():
38  self.setParam(k,params[k])
39  self.checkParams()
40 
41  def submitJob(self,jobConfig):
42  """Submit a JobRunner job as a LSF batch job."""
43  condorScript = condorScriptTemplate % jobConfig
44  print (condorScript)
45  script = open('condorSubmit.sub','w')
46  script.write(condorScript)
47  script.close()
48  os.chmod('condorSubmit.sub',0o755)
49  batchCmd = 'condor_submit condorSubmit.sub'
50  print (batchCmd )
51  os.system(batchCmd)
52  return None
python.HTCondorJobRunner.HTCondorJobRunner
Definition: HTCondorJobRunner.py:28
python.HTCondorJobRunner.HTCondorJobRunner.submitJob
def submitJob(self, jobConfig)
Definition: HTCondorJobRunner.py:41
python.HTCondorJobRunner.HTCondorJobRunner.__init__
def __init__(self, **params)
Definition: HTCondorJobRunner.py:31
python.JobRunner.JobRunner.checkParams
def checkParams(self)
Definition: JobRunner.py:209
Trk::open
@ open
Definition: BinningType.h:40
python.JobRunner.JobRunner
Definition: JobRunner.py:98
python.JobRunner.JobRunner.setParam
def setParam(self, name, value=None, description=None, isSpecial=None, insertAtFront=False)
Definition: JobRunner.py:157