ATLAS Offline Software
Loading...
Searching...
No Matches
PandaJobRunner.py
Go to the documentation of this file.
1#!/usr/bin/env python
2
3# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
4"""
5PandaJobRunner is a JobRunner for running jobs on the grid using pathena.
6
7Written by Juerg Beringer (LBNL) in 2009.
8"""
9__author__ = 'Juerg Beringer'
10__version__ = '$Id: PandaJobRunner.py 345959 2011-02-15 15:20:18Z gwilliam $'
11
12
13from JobRunner import JobRunner
14import os
15
16
17# Default template of job submission script
18gridSubmitScript = """#!/bin/sh
19echo ''
20echo "Setting up release %(release)s"
21%(cmdsetup)s
22echo ''
23echo 'Setting up standard grid environment ...'
24source /afs/cern.ch/atlas/offline/external/GRID/ddm/DQ2Clients/setup.sh
25voms-proxy-init -voms atlas
26source /afs/cern.ch/atlas/offline/external/GRID/DA/panda-client/latest/etc/panda/panda_setup.sh
27echo ''
28echo "Creating grid job submission directory (`date`) ..."
29griddir=$TestArea/gridsubmit/%(jobname)s
30mkdir -p $griddir
31cd $griddir
32echo ''
33echo "Copying files (`date`) ..."
34%(cmdjobpreprocessing)s
35cp -p %(configfile)s .
36%(cmdcopyfiles)s
37echo ''
38echo "Creating POOL file catalog (`date`) ..."
39%(cmddefinepoolcatalog)s
40echo ''
41echo "Running pathena (`date`) ..."
42pathena `basename %(configfile)s` %(joboptionpath)s --extOutFile %(outputfilestring)s --inDS %(inputds)s --outDS %(griduser)s.%(jobname)s --nFilesPerJob %(filesperjob)s --nFiles %(maxjobs)s --site %(gridsite)s
43echo "Postprocessing (`date`) ..."
44%(cmdjobpostprocessing)s
45# Deliberately not removing grid job submit directory under $TestArea
46# cd ..
47# rm -rf $griddir
48"""
49
50
52 """PandaJobRunner - run jobs on the grid using pathena"""
53
54 def __init__(self,**params):
55 """Constructor (takes any number of parameters as an argument)."""
56 JobRunner.__init__(self)
57
58 # Set user-specified parameters only after PandaJobRunner defaults
59 self.setParam('inputds','','Input dataset name (for grid jobs)',insertAtFront=True)
60 self.setParam('griduser','','User part of grid job name, e.g. JuergBeringer',insertAtFront=True)
61 self.setParam('gridsite','AUTO','Site name where jobs are sent (default:AUTO)',insertAtFront=True)
62 self.setParam('script',gridSubmitScript)
63 self.setParam('addinputtopoolcatalog',False)
64 for k in params.keys():
65 self.setParam(k,params[k])
66 self.checkParams()
67
68 def submitJob(self,jobConfig):
69 """Submit a JobRunner job as a grid job."""
70 scriptfile = jobConfig['scriptfile']
71 logfile = jobConfig['logfile']
72 os.system('%s 2>&1 | tee %s' % (scriptfile,logfile))
73 return None
setParam(self, name, value=None, description=None, isSpecial=None, insertAtFront=False)
Definition JobRunner.py:157