CMS 3D CMS Logo

Functions
cmsDriver Namespace Reference

Functions

def run ()
 

Function Documentation

def cmsDriver.run ( )

Definition at line 6 of file cmsDriver.py.

References FrontierConditions_GlobalTag_cff.file, cmsDriverOptions.OptionsFromCommandLine(), edm.print(), and split.

6 def run():
7  import sys
8  import os
9  import Configuration.Applications
10  from Configuration.Applications.ConfigBuilder import ConfigBuilder
11  from Configuration.Applications.cmsDriverOptions import OptionsFromCommandLine
12  options = OptionsFromCommandLine()
13 
14  # after cleanup of all config parameters pass it to the ConfigBuilder
15  configBuilder = ConfigBuilder(options, with_output = True, with_input = True)
16 
17  # Switch on any eras that have been specified. This is not required to create
18  # the file, it is only relevant if dump_python is set. It does have to be done
19  # before the prepare() call though. If not, then the config files will be loaded
20  # without applying the era changes. This doesn't affect the config file written,
21  # but when the dump_python branch uses execfile to read it back in it doesn't
22  # reload the modules - it picks up a reference to the already loaded ones.
23  if hasattr( options, "era" ) and options.era is not None :
24  from Configuration.StandardSequences.Eras import eras
25  for eraName in options.era.split(',') :
26  getattr( eras, eraName )._setChosen()
27 
28  configBuilder.prepare()
29  # fetch the results and write it to file
30  config = file(options.python_filename,"w")
31  config.write(configBuilder.pythonCfgCode)
32  config.close()
33 
34  # handle different dump options
35  if options.dump_python:
36  result = {}
37  execfile(options.python_filename, result)
38  process = result["process"]
39  expanded = process.dumpPython()
40  expandedFile = file(options.python_filename,"w")
41  expandedFile.write(expanded)
42  expandedFile.close()
43  print("Expanded config file", options.python_filename, "created")
44  sys.exit(0)
45 
46  if options.no_exec_flag:
47  print("Config file "+options.python_filename+ " created")
48  sys.exit(0)
49  else:
50  commandString = options.prefix+" cmsRun "+options.suffix
51  print("Starting "+commandString+' '+options.python_filename)
52  commands = commandString.lstrip().split()
53  os.execvpe(commands[0],commands+[options.python_filename],os.environ)
54  sys.exit()
55 
56 run()
57 
58 
59 
60 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def run()
Definition: cmsDriver.py:6
double split
Definition: MVATrainer.cc:139