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 56 of file runJobs.py.

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

◆ 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 30 of file runJobs.py.

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

◆ make_runner()

def runJobs.make_runner (   runner_type,
  flags 
)

Definition at line 115 of file runJobs.py.

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

◆ process_flags()

def runJobs.process_flags (   options,
  legacy = False 
)

Definition at line 67 of file runJobs.py.

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

Variable Documentation

◆ __authors__

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

Definition at line 9 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 11 of file runJobs.py.

◆ __version__

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

Definition at line 10 of file runJobs.py.

◆ action

runJobs.action

Definition at line 124 of file runJobs.py.

◆ args

runJobs.args

Definition at line 214 of file runJobs.py.

◆ choices

runJobs.choices

Definition at line 162 of file runJobs.py.

◆ cmd

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

Definition at line 120 of file runJobs.py.

◆ comment

runJobs.comment

Definition at line 311 of file runJobs.py.

◆ default

runJobs.default

Definition at line 124 of file runJobs.py.

◆ deprecated

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

Definition at line 191 of file runJobs.py.

◆ dest

runJobs.dest

Definition at line 124 of file runJobs.py.

◆ dsname

runJobs.dsname = args[1]

Definition at line 219 of file runJobs.py.

◆ execopt

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

Definition at line 160 of file runJobs.py.

◆ files

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

Definition at line 226 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 182 of file runJobs.py.

◆ flags

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

Definition at line 251 of file runJobs.py.

◆ grid_mode

string runJobs.grid_mode = bool(opts.legacy_griduser)

Definition at line 227 of file runJobs.py.

◆ help

runJobs.help

Definition at line 125 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 172 of file runJobs.py.

◆ joboptiontemplate

runJobs.joboptiontemplate = args[0]

Definition at line 218 of file runJobs.py.

◆ legacy_options

int runJobs.legacy_options = 4

Definition at line 222 of file runJobs.py.

◆ metavar

runJobs.metavar

Definition at line 130 of file runJobs.py.

◆ None

runJobs.None

Definition at line 164 of file runJobs.py.

◆ opts

runJobs.opts

Definition at line 214 of file runJobs.py.

◆ parser

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

Definition at line 123 of file runJobs.py.

◆ postprocsteps

runJobs.postprocsteps

Definition at line 311 of file runJobs.py.

◆ runner

def runJobs.runner = make_runner(runner_type, flags)

Definition at line 281 of file runJobs.py.

◆ runner_type

dictionary runJobs.runner_type = opts.legacy_runner

Definition at line 228 of file runJobs.py.

◆ taskname

runJobs.taskname = args[2]

Definition at line 220 of file runJobs.py.

◆ type

runJobs.type

Definition at line 128 of file runJobs.py.

◆ workdir

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

Definition at line 269 of file runJobs.py.

runJobs.extract_file_list_legacy
def extract_file_list_legacy(inputdata, options)
Definition: runJobs.py:30
runJobs.make_runner
def make_runner(runner_type, flags)
Definition: runJobs.py:115
runJobs.extract_file_list
def extract_file_list(options)
Definition: runJobs.py:56
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
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:67