CMS 3D CMS Logo

Functions

cmsDriver Namespace Reference

Functions

def run

Function Documentation

def cmsDriver::run ( )

Definition at line 5 of file cmsDriver.py.

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