Public Member Functions | |
def | __init__ |
def | createCrabCfg |
Public Attributes | |
crabWorkingDir | |
dataset | |
jobmode |
Subclass of `GenericValidation` which is the base for validations using datasets.
Definition at line 104 of file genericValidation.py.
def genericValidation::GenericValidationData::__init__ | ( | self, | |
valName, | |||
alignment, | |||
config, | |||
valType, | |||
addDefaults = {} , |
|||
addMandatories = [] |
|||
) |
This method adds additional items to the `self.general` dictionary which are only needed for validations using datasets. Arguments: - `valName`: String which identifies individual validation instances - `alignment`: `Alignment` instance to validate - `config`: `BetterConfigParser` instance which includes the configuration of the validations - `valType`: String which specifies the type of validation - `addDefaults`: Dictionary which contains default values for individual validations in addition to the general default values - `addMandatories`: List which contains mandatory parameters for individual validations in addition to the general mandatory parameters (currently there are no general mandatories)
Definition at line 110 of file genericValidation.py.
00111 {}, addMandatories=[]): 00112 """ 00113 This method adds additional items to the `self.general` dictionary 00114 which are only needed for validations using datasets. 00115 00116 Arguments: 00117 - `valName`: String which identifies individual validation instances 00118 - `alignment`: `Alignment` instance to validate 00119 - `config`: `BetterConfigParser` instance which includes the 00120 configuration of the validations 00121 - `valType`: String which specifies the type of validation 00122 - `addDefaults`: Dictionary which contains default values for individual 00123 validations in addition to the general default values 00124 - `addMandatories`: List which contains mandatory parameters for 00125 individual validations in addition to the general 00126 mandatory parameters 00127 (currently there are no general mandatories) 00128 """ 00129 00130 GenericValidation.__init__(self, valName, alignment, config) 00131 defaults = {"jobmode": self.jobmode, 00132 "runRange": "", 00133 "firstRun": "", 00134 "lastRun": "", 00135 "begin": "", 00136 "end": "", 00137 "JSON": "" 00138 } 00139 defaults.update(addDefaults) 00140 mandatories = [] 00141 mandatories += addMandatories 00142 theUpdate = config.getResultingSection(valType+":"+self.name, 00143 defaultDict = defaults, 00144 demandPars = mandatories) 00145 self.general.update(theUpdate) 00146 self.jobmode = self.general["jobmode"] 00147 00148 knownOpts = defaults.keys()+mandatories 00149 ignoreOpts = [] 00150 if self.jobmode.split(",")[0] == "crab" \ 00151 or self.__class__.__name__=="OfflineValidationParallel": 00152 knownOpts.append("parallelJobs") 00153 else: 00154 ignoreOpts.append("parallelJobs") 00155 config.checkInput(valType+":"+self.name, 00156 knownSimpleOptions = knownOpts, 00157 ignoreOptions = ignoreOpts) 00158 00159 if self.general["dataset"] not in globalDictionaries.usedDatasets: 00160 globalDictionaries.usedDatasets[self.general["dataset"]] = Dataset( 00161 self.general["dataset"] ) 00162 self.dataset = globalDictionaries.usedDatasets[self.general["dataset"]] 00163 00164 if not self.jobmode.split( ',' )[0] == "crab": 00165 try: 00166 self.general["datasetDefinition"] = self.dataset.datasetSnippet( 00167 jsonPath = self.general["JSON"], 00168 nEvents = self.general["maxevents"], 00169 firstRun = self.general["firstRun"], 00170 lastRun = self.general["lastRun"], 00171 begin = self.general["begin"], 00172 end = self.general["end"] ) 00173 except AllInOneError, e: 00174 msg = "In section [%s:%s]: "%(valType, self.name) 00175 msg += str(e) 00176 raise AllInOneError(msg) 00177 else: 00178 if self.dataset.predefined(): 00179 msg = ("For jobmode 'crab' you cannot use predefined datasets " 00180 "(in your case: '%s')."%( self.dataset.name() )) 00181 raise AllInOneError( msg ) 00182 try: 00183 theUpdate = config.getResultingSection(valType+":"+self.name, 00184 demandPars = ["parallelJobs"]) 00185 except AllInOneError, e: 00186 msg = str(e)[:-1]+" when using 'jobmode: crab'." 00187 raise AllInOneError(msg) 00188 self.general.update(theUpdate) 00189 if self.general["begin"] or self.general["end"]: 00190 ( self.general["begin"], 00191 self.general["end"], 00192 self.general["firstRun"], 00193 self.general["lastRun"] ) = self.dataset.convertTimeToRun( 00194 firstRun = self.general["firstRun"], 00195 lastRun = self.general["lastRun"], 00196 begin = self.general["begin"], 00197 end = self.general["end"], 00198 shortTuple = False) 00199 if self.general["begin"] == None: 00200 self.general["begin"] = "" 00201 if self.general["end"] == None: 00202 self.general["end"] = "" 00203 self.general["firstRun"] = str( self.general["firstRun"] ) 00204 self.general["lastRun"] = str( self.general["lastRun"] ) 00205 if ( not self.general["firstRun"] ) and \ 00206 ( self.general["end"] or self.general["lastRun"] ): 00207 self.general["firstRun"] = str( 00208 self.dataset.runList()[0]["run_number"]) 00209 if ( not self.general["lastRun"] ) and \ 00210 ( self.general["begin"] or self.general["firstRun"] ): 00211 self.general["lastRun"] = str( 00212 self.dataset.runList()[-1]["run_number"]) 00213 if self.general["firstRun"] and self.general["lastRun"]: 00214 if int(self.general["firstRun"]) > int(self.general["lastRun"]): 00215 msg = ( "The lower time/runrange limit ('begin'/'firstRun') " 00216 "chosen is greater than the upper time/runrange limit " 00217 "('end'/'lastRun').") 00218 raise AllInOneError( msg ) 00219 self.general["runRange"] = (self.general["firstRun"] 00220 + '-' + self.general["lastRun"]) 00221 try: 00222 self.general["datasetDefinition"] = self.dataset.datasetSnippet( 00223 jsonPath = self.general["JSON"], 00224 nEvents = self.general["maxevents"], 00225 firstRun = self.general["firstRun"], 00226 lastRun = self.general["lastRun"], 00227 begin = self.general["begin"], 00228 end = self.general["end"], 00229 crab = True ) 00230 except AllInOneError, e: 00231 msg = "In section [%s:%s]: "%(valType, self.name) 00232 msg += str( e ) 00233 raise AllInOneError( msg ) 00234
def genericValidation::GenericValidationData::createCrabCfg | ( | self, | |
path, | |||
crabCfgBaseName | |||
) |
Method which creates a `crab.cfg` for a validation on datasets. Arguments: - `path`: Path at which the file will be stored. - `crabCfgBaseName`: String which depends on the actual type of validation calling this method.
Reimplemented from genericValidation::GenericValidation.
Reimplemented in monteCarloValidation::MonteCarloValidation, offlineValidation::OfflineValidation, trackSplittingValidation::TrackSplittingValidation, and zMuMuValidation::ZMuMuValidation.
Definition at line 235 of file genericValidation.py.
00236 : 00237 """ 00238 Method which creates a `crab.cfg` for a validation on datasets. 00239 00240 Arguments: 00241 - `path`: Path at which the file will be stored. 00242 - `crabCfgBaseName`: String which depends on the actual type of 00243 validation calling this method. 00244 """ 00245 crabCfgName = "crab.%s.%s.%s.cfg"%( crabCfgBaseName, self.name, 00246 self.alignmentToValidate.name ) 00247 repMap = self.getRepMap() 00248 repMap["script"] = "dummy_script.sh" 00249 # repMap["crabOutputDir"] = os.path.basename( path ) 00250 repMap["crabWorkingDir"] = crabCfgName.split( '.cfg' )[0] 00251 self.crabWorkingDir = repMap["crabWorkingDir"] 00252 repMap["numberOfJobs"] = self.general["parallelJobs"] 00253 repMap["cfgFile"] = self.configFiles[0] 00254 repMap["queue"] = self.jobmode.split( ',' )[1].split( '-q' )[1] 00255 if self.dataset.dataType() == "mc": 00256 repMap["McOrData"] = "events = .oO[nEvents]Oo." 00257 elif self.dataset.dataType() == "data": 00258 repMap["McOrData"] = "lumis = -1" 00259 if self.jobmode.split( ',' )[0] == "crab": 00260 print ("For jobmode 'crab' the parameter 'maxevents' will be " 00261 "ignored and all events will be processed.") 00262 crabCfg = {crabCfgName: replaceByMap( configTemplates.crabCfgTemplate, 00263 repMap ) } 00264 return GenericValidation.createCrabCfg( self, crabCfg, path )
Definition at line 242 of file genericValidation.py.
Definition at line 126 of file genericValidation.py.
Reimplemented from genericValidation::GenericValidation.
Definition at line 126 of file genericValidation.py.