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