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