CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
cmsDriver.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 # A Pyrelval Wrapper
4 
5 def run():
6  import sys
7  import os
8  import Configuration.Applications
9  from Configuration.Applications.ConfigBuilder import ConfigBuilder
10  from Configuration.Applications.cmsDriverOptions import OptionsFromCommandLine
11  options = OptionsFromCommandLine()
12 
13  # after cleanup of all config parameters pass it to the ConfigBuilder
14  configBuilder = ConfigBuilder(options, with_output = True, with_input = True)
15  configBuilder.prepare()
16  # fetch the results and write it to file
17  config = file(options.python_filename,"w")
18  config.write(configBuilder.pythonCfgCode)
19  config.close()
20 
21  # handle different dump options
22  if options.dump_python:
23  result = {}
24  execfile(options.python_filename, result)
25  process = result["process"]
26  expanded = process.dumpPython()
27  expandedFile = file(options.python_filename,"w")
28  expandedFile.write(expanded)
29  expandedFile.close()
30  print "Expanded config file", options.python_filename, "created"
31  sys.exit(0)
32 
33  if options.no_exec_flag:
34  print "Config file "+options.python_filename+ " created"
35  sys.exit(0)
36  else:
37  commandString = options.prefix+" cmsRun "+options.suffix
38  print "Starting "+commandString+' '+options.python_filename
39  commands = commandString.lstrip().split()
40  os.execvpe(commands[0],commands+[options.python_filename],os.environ)
41  sys.exit()
42 
43 run()
44 
45 
46 
def run
Definition: cmsDriver.py:5
double split
Definition: MVATrainer.cc:139