CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Configuration/PyReleaseValidation/scripts/cmsDriver.py

Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 # A Pyrelval Wrapper
00004 
00005 
00006 
00007 from threading import Thread
00008 
00009 class forkit(Thread):
00010     def __init__(self):
00011         Thread.__init__(self)
00012     def run(self):
00013         import sys
00014         import os
00015         import Configuration.PyReleaseValidation
00016         from Configuration.PyReleaseValidation.ConfigBuilder import ConfigBuilder, defaultOptions
00017         from Configuration.PyReleaseValidation.cmsDriverOptions import options, python_config_filename
00018         
00019         # after cleanup of all config parameters pass it to the ConfigBuilder
00020         configBuilder = ConfigBuilder(options, with_output = True, with_input = True)
00021         configBuilder.prepare()
00022         
00023         # fetch the results and write it to file
00024         if options.python_filename: python_config_filename = options.python_filename
00025         config = file(python_config_filename,"w")
00026         config.write(configBuilder.pythonCfgCode)
00027         config.close()
00028 
00029         # handle different dump options
00030         if options.dump_python:
00031             result = {}
00032             execfile(python_config_filename, result)
00033             process = result["process"]
00034             expanded = process.dumpPython()
00035             expandedFile = file(python_config_filename,"w")
00036             expandedFile.write(expanded)
00037             expandedFile.close()
00038             print "Expanded config file", python_config_filename, "created"
00039             sys.exit(0)           
00040   
00041         if options.no_exec_flag:
00042             print "Config file "+python_config_filename+ " created"
00043             sys.exit(0)
00044         else:
00045             commandString = options.prefix+" cmsRun"
00046             print "Starting "+commandString+' '+python_config_filename
00047             commands = commandString.lstrip().split()
00048             os.execvpe(commands[0],commands+[python_config_filename],os.environ)
00049             sys.exit()
00050 
00051 import os
00052 current = forkit()
00053 current.start()
00054     
00055 
00056 
00057