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 
6 
7 from threading import Thread
8 
9 class forkit(Thread):
10  def __init__(self):
11  Thread.__init__(self)
12  def run(self):
13  import sys
14  import os
15  import Configuration.PyReleaseValidation
16  from Configuration.PyReleaseValidation.ConfigBuilder import ConfigBuilder, defaultOptions
17  from Configuration.PyReleaseValidation.cmsDriverOptions import options, python_config_filename
18 
19  # after cleanup of all config parameters pass it to the ConfigBuilder
20  configBuilder = ConfigBuilder(options, with_output = True, with_input = True)
21  configBuilder.prepare()
22 
23  # fetch the results and write it to file
24  if options.python_filename: python_config_filename = options.python_filename
25  config = file(python_config_filename,"w")
26  config.write(configBuilder.pythonCfgCode)
27  config.close()
28 
29  # handle different dump options
30  if options.dump_python:
31  result = {}
32  execfile(python_config_filename, result)
33  process = result["process"]
34  expanded = process.dumpPython()
35  expandedFile = file(python_config_filename,"w")
36  expandedFile.write(expanded)
37  expandedFile.close()
38  print "Expanded config file", python_config_filename, "created"
39  sys.exit(0)
40 
41  if options.no_exec_flag:
42  print "Config file "+python_config_filename+ " created"
43  sys.exit(0)
44  else:
45  commandString = options.prefix+" cmsRun"
46  print "Starting "+commandString+' '+python_config_filename
47  commands = commandString.lstrip().split()
48  os.execvpe(commands[0],commands+[python_config_filename],os.environ)
49  sys.exit()
50 
51 import os
52 current = forkit()
53 current.start()
54 
55 
56 
57 
double split
Definition: MVATrainer.cc:139