ATLAS Offline Software
Functions | Variables
runJobs Namespace Reference

Functions

def extract_file_list_legacy (inputdata, options)
 
def extract_file_list (options)
 
def process_flags (options, legacy=False)
 
def make_runner (runner_type, flags)
 

Variables

list __authors__ = ['Juerg Beringer', 'Carl Suster']
 
string __version__ = 'runJobs.py atlas/athena'
 
string __usage__
 
 cmd = subprocess.list2cmdline(sys.argv)
 
 parser = OptionParser(usage=__usage__, version=__version__)
 
 dest
 
 action
 
 default
 
 help
 
 type
 
 metavar
 
 execopt = OptionGroup(parser, 'Execution Options')
 
 choices
 
 None
 
 inopt
 
 filtopt
 
 deprecated = OptionGroup(parser, 'Deprecated Options')
 
 opts
 
 args
 
 joboptiontemplate = args[0]
 
 dsname = args[1]
 
 taskname = args[2]
 
int legacy_options = 4
 
def files = extract_file_list_legacy(args[3], opts)
 
 grid_mode = bool(opts.legacy_griduser)
 
 runner_type = opts.legacy_runner
 
def flags = process_flags(opts, legacy=legacy_options)
 
 workdir = os.path.join(os.getcwd(), dsname, taskname)
 
def runner = make_runner(runner_type, flags)
 
 postprocsteps
 
 comment
 

Function Documentation

◆ extract_file_list()

def runJobs.extract_file_list (   options)
Use new flags to work out input file list. 

Definition at line 55 of file runJobs.py.

55 def extract_file_list(options):
56  ''' Use new flags to work out input file list. '''
57  if options.in_directory:
58  fs = DiskUtils.FileSet.from_directory(options.in_directory)
59  elif options.in_list:
60  fs = DiskUtils.FileSet.from_file_containing_list(options.in_list)
61  return list(sorted(fs
62  .matching(options.f_match)
63  .excluding(options.f_exclude)
64  ))
65 

◆ extract_file_list_legacy()

def runJobs.extract_file_list_legacy (   inputdata,
  options 
)
Reads several legacy options to work out what input data to use. 

Definition at line 29 of file runJobs.py.

29 def extract_file_list_legacy(inputdata, options):
30  ''' Reads several legacy options to work out what input data to use. '''
31  if options.legacy_griduser:
32  fs = [inputdata]
33  elif options.legacy_fromcastor:
34  # INPUTDATA specifies a directory with files
35  pattern = options.legacy_filter or (None if options.bytestream else '.*ESD.*')
36  fs = DiskUtils.FileSet.from_directory(inputdata).matching(pattern)
37  elif os.path.isfile(inputdata):
38  # inputdata is a text file with filenames
39  fs = DiskUtils.FileSet.from_file_containing_list(inputdata)
40  elif options.legacy_runoverdpd:
41  # INPUTDATA is filename
42  rundir = os.path.join(os.getcwd(), dsname)
43  if not os.path.exists(rundir):
44  raise Exception('Run ' + dsname + ' (directory ' + rundir + ') not found')
45  dpddir = os.path.join(rundir, inputdata)
46  if not os.path.exists(dpddir):
47  raise Exception('Dataset with name ' + inputdata + ' (directory ' + dpddir + ') not found')
48  fs = DiskUtils.FileSet.from_glob(os.path.join(dpddir, '*', '*-dpd.root*'))
49  else:
50  # INPUTDATA is a directory with files
51  pattern = options.legacy_filter or '*.root*'
52  fs = DiskUtils.FileSet.from_glob(os.path.join(inputdata, pattern))
53  return list(sorted(fs))
54 

◆ make_runner()

def runJobs.make_runner (   runner_type,
  flags 
)

Definition at line 114 of file runJobs.py.

114 def make_runner(runner_type, flags):
115  runner_class = InDetBeamSpotExample.loadClass(runner_type)
116  return runner_class(**flags)
117 

◆ process_flags()

def runJobs.process_flags (   options,
  legacy = False 
)

Definition at line 66 of file runJobs.py.

66 def process_flags(options, legacy=False):
67  flags = {
68  'inputds' : '',
69  'bytestream' : options.bytestream,
70  'DataSource' : 'geant4' if options.is_mc else 'data',
71  'evtmax' : options.evtmax,
72  'maxjobs' : options.maxjobs,
73  'outputlevel' : options.outputlevel,
74  'logmail' : options.users,
75  'alignmentfile' : options.alignmentfile,
76  'beamspotfile' : options.beamspotfile,
77  'autoconfparams' : options.autoconfparams,
78  'taskpostprocsteps' : options.postprocsteps,
79  'filesperjob' : options.nfiles,
80  'lbperjob' : options.lbperjob,
81  'batchqueue' : options.batchqueue,
82  'gridsite' : options.gridsite,
83  'addinputtopoolcatalog' : not (options.bytestream or options.submit == 'grid' or options.legacy_griduser),
84  }
85 
86  # List of desired output files. For grid jobs, it must specify exactly
87  # the expected files (otherwise the grid jobs will fail or not return the
88  # desired output). For all other jobs, it can be an inclusive list of
89  # possible outputs and JobRunner will return only the actually present
90  # output files when asked for output files.
91  if options.outputfilelist:
92  flags['outputfilelist'] = [ f.strip() for f in options.outputfilelist.split(',') ]
93  else:
94  flags['outputfilelist'] = ['dpd.root', 'nt.root', 'monitoring.root', 'beamspot.db']
95 
96  if legacy:
97  flags['griduser'] = options.legacy_griduser
98  else:
99  flags['griduser'] = '.'.join(['user', options.grid_user or os.getenv('USER')])
100 
101  if options.legacy_runoverdpd and not options.lbperjob:
102  flags['maxjobs'] = 1
103 
104  for s in options.params.split(', '):
105  if s:
106  try:
107  p = s.split('=', 1)
108  flags[p[0].strip()] = eval(p[1].strip())
109  except:
110  print ('\nERROR parsing user parameter', p, '- parameter will be ignored')
111 
112  return flags
113 

Variable Documentation

◆ __authors__

list runJobs.__authors__ = ['Juerg Beringer', 'Carl Suster']
private

Definition at line 8 of file runJobs.py.

◆ __usage__

string runJobs.__usage__
private
Initial value:
1 = """%prog [options] JOBOPTIONTEMPLATE DATASET TASK
2 
3 Templates: - InDetBeamSpotExample/VertexTemplate.py
4  - InDetBeamSpotExample/*Template.py
5  - your own template file
6 
7 See the comment field of jobs (e.g. MON.DB_BEAMSPOT jobs) in the beam spot
8 summary webpage for real usage examples.
9 """

Definition at line 10 of file runJobs.py.

◆ __version__

string runJobs.__version__ = 'runJobs.py atlas/athena'
private

Definition at line 9 of file runJobs.py.

◆ action

runJobs.action

Definition at line 123 of file runJobs.py.

◆ args

runJobs.args

Definition at line 213 of file runJobs.py.

◆ choices

runJobs.choices

Definition at line 161 of file runJobs.py.

◆ cmd

runJobs.cmd = subprocess.list2cmdline(sys.argv)

Definition at line 119 of file runJobs.py.

◆ comment

runJobs.comment

Definition at line 310 of file runJobs.py.

◆ default

runJobs.default

Definition at line 123 of file runJobs.py.

◆ deprecated

runJobs.deprecated = OptionGroup(parser, 'Deprecated Options')

Definition at line 190 of file runJobs.py.

◆ dest

runJobs.dest

Definition at line 123 of file runJobs.py.

◆ dsname

runJobs.dsname = args[1]

Definition at line 218 of file runJobs.py.

◆ execopt

runJobs.execopt = OptionGroup(parser, 'Execution Options')

Definition at line 159 of file runJobs.py.

◆ files

def runJobs.files = extract_file_list_legacy(args[3], opts)

Definition at line 225 of file runJobs.py.

◆ filtopt

runJobs.filtopt
Initial value:
1 = OptionGroup(parser, 'Input Filtering Options',
2  "Optional filters to select input files.")

Definition at line 181 of file runJobs.py.

◆ flags

def runJobs.flags = process_flags(opts, legacy=legacy_options)

Definition at line 250 of file runJobs.py.

◆ grid_mode

string runJobs.grid_mode = bool(opts.legacy_griduser)

Definition at line 226 of file runJobs.py.

◆ help

runJobs.help

Definition at line 124 of file runJobs.py.

◆ inopt

runJobs.inopt
Initial value:
1 = OptionGroup(parser, 'Input File Options',
2  "One of these must be specified.")

Definition at line 171 of file runJobs.py.

◆ joboptiontemplate

runJobs.joboptiontemplate = args[0]

Definition at line 217 of file runJobs.py.

◆ legacy_options

int runJobs.legacy_options = 4

Definition at line 221 of file runJobs.py.

◆ metavar

runJobs.metavar

Definition at line 129 of file runJobs.py.

◆ None

runJobs.None

Definition at line 163 of file runJobs.py.

◆ opts

runJobs.opts

Definition at line 213 of file runJobs.py.

◆ parser

runJobs.parser = OptionParser(usage=__usage__, version=__version__)

Definition at line 122 of file runJobs.py.

◆ postprocsteps

runJobs.postprocsteps

Definition at line 310 of file runJobs.py.

◆ runner

def runJobs.runner = make_runner(runner_type, flags)

Definition at line 280 of file runJobs.py.

◆ runner_type

dictionary runJobs.runner_type = opts.legacy_runner

Definition at line 227 of file runJobs.py.

◆ taskname

runJobs.taskname = args[2]

Definition at line 219 of file runJobs.py.

◆ type

runJobs.type

Definition at line 127 of file runJobs.py.

◆ workdir

runJobs.workdir = os.path.join(os.getcwd(), dsname, taskname)

Definition at line 268 of file runJobs.py.

DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename R::value_type > sorted(const R &r, PROJ proj={})
Helper function to create a sorted vector from an unsorted range.
runJobs.extract_file_list_legacy
def extract_file_list_legacy(inputdata, options)
Definition: runJobs.py:29
runJobs.make_runner
def make_runner(runner_type, flags)
Definition: runJobs.py:114
runJobs.extract_file_list
def extract_file_list(options)
Definition: runJobs.py:55
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
runJobs.process_flags
def process_flags(options, legacy=False)
Definition: runJobs.py:66