ATLAS Offline Software
PDSFJobRunner.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 
5 
6 """
7 PDSFJobRunner is a JobRunner for running jobs with the SGE batch system on pdsf.nersc.gov.
8 
9 Written by Juerg Beringer (LBNL) in 2009.
10 """
11 __author__ = 'Juerg Beringer'
12 __version__ = '$Id: PDSFJobRunner.py 343090 2011-02-01 00:39:37Z hurwitz $'
13 
14 
15 from JobRunner import JobRunner
16 import os
17 import time
18 
19 preScript = """#!/bin/bash
20 
21 #$ -hard
22 #$ -l h_cpu=24:00:00
23 #$ -l eliza4io=1
24 
25 ulimit -c 0
26 
27 echo "Starting on host $(hostname) on $(date)"
28 echo "JOB_ID=$JOB_ID"
29 echo ""
30 ulimit -a
31 echo ""
32 
33 """
34 
36  """PDSFJobRunner - run jobs using the SGE batch system on PDSF"""
37 
38  def __init__(self,**params):
39  """Constructor (takes any number of parameters as an argument)."""
40  JobRunner.__init__(self)
41 
42  # Set user-specified parameters only after PDSFJobRunner defaults
43  self.setParam('batchqueue','all.64bit.q','Batch queue')
44  script = self.getParam('script')
45  self.setParam('script',preScript+script)
46  for k in params.keys():
47  self.setParam(k,params[k])
48  # SGE runs jobs from where they were submitted, so change rundir explicitly to jobdir
49  self.setParam('rundir','%(jobdir)s')
50  self.setParam('maketmpdir','')
51  self.checkParams()
52 
53  def submitJob(self,jobConfig):
54  """Submit a JobRunner job as a SGE batch job."""
55  #batchCmd = 'qsub -q %(batchqueue)s -N %(jobname)s -j y -o %(logfile)s %(scriptfile)s' % jobConfig
56  batchCmd = 'qsub -N %(jobname)s -j y -o %(logfile)s %(scriptfile)s' % jobConfig
57  print (batchCmd)
58  time.sleep(5)
59  os.system(batchCmd)
60  return None
python.JobRunner.JobRunner.getParam
def getParam(self, name)
Definition: JobRunner.py:192
python.JobRunner.JobRunner.checkParams
def checkParams(self)
Definition: JobRunner.py:209
python.PDSFJobRunner.PDSFJobRunner
Definition: PDSFJobRunner.py:35
python.PDSFJobRunner.PDSFJobRunner.submitJob
def submitJob(self, jobConfig)
Definition: PDSFJobRunner.py:53
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
python.PDSFJobRunner.PDSFJobRunner.__init__
def __init__(self, **params)
Definition: PDSFJobRunner.py:38