CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/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 def run():
00006         import sys
00007         import os
00008         import Configuration.PyReleaseValidation
00009         from Configuration.PyReleaseValidation.ConfigBuilder import ConfigBuilder
00010         from Configuration.PyReleaseValidation.cmsDriverOptions import OptionsFromCommandLine
00011         options = OptionsFromCommandLine()
00012         
00013         # after cleanup of all config parameters pass it to the ConfigBuilder
00014         configBuilder = ConfigBuilder(options, with_output = True, with_input = True)
00015         configBuilder.prepare()
00016         # fetch the results and write it to file
00017         config = file(options.python_filename,"w")
00018         config.write(configBuilder.pythonCfgCode)
00019         config.close()
00020 
00021         # handle different dump options
00022         if options.dump_python:
00023             result = {}
00024             execfile(options.python_filename, result)
00025             process = result["process"]
00026             expanded = process.dumpPython()
00027             expandedFile = file(options.python_filename,"w")
00028             expandedFile.write(expanded)
00029             expandedFile.close()
00030             print "Expanded config file", options.python_filename, "created"
00031             sys.exit(0)           
00032   
00033         if options.no_exec_flag:
00034             print "Config file "+options.python_filename+ " created"
00035             sys.exit(0)
00036         else:
00037             commandString = options.prefix+" cmsRun "+options.suffix
00038             print "Starting "+commandString+' '+options.python_filename
00039             commands = commandString.lstrip().split()
00040             os.execvpe(commands[0],commands+[options.python_filename],os.environ)
00041             sys.exit()
00042 
00043 run()
00044 
00045 
00046