CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
validateAlignments.ValidationJob Class Reference
Inheritance diagram for validateAlignments.ValidationJob:
validateAlignments.ValidationBase

Public Member Functions

def __init__ (self, validation, config, options, args, kwargs)
 
def __iter__ (self)
 
def __next__ (self)
 
def createJob (self)
 
def getValidation (self)
 
def needsproxy (self)
 
def runJob (self)
 
- Public Member Functions inherited from validateAlignments.ValidationBase
def __init__ (self, validation, config, options)
 
def createJob (self)
 
def getValidation (self)
 
def needsproxy (self)
 
def runJob (self)
 

Public Attributes

 end
 
 JobId
 
 scripts
 
 start
 
 validation
 
- Public Attributes inherited from validateAlignments.ValidationBase
 alignments
 
 commandLineOptions
 
 config
 
 preexisting
 
 valName
 
 valSection
 
 valType
 

Static Public Attributes

 condorConf
 
 interactCount
 
 jobCount
 

Private Member Functions

def __createJob (self, jobMode, outpath)
 
def __getValidation (self, valType, name, alignments, config, options)
 

Detailed Description

Definition at line 116 of file validateAlignments.py.

Constructor & Destructor Documentation

def validateAlignments.ValidationJob.__init__ (   self,
  validation,
  config,
  options,
  args,
  kwargs 
)

Definition at line 123 of file validateAlignments.py.

123  def __init__( self, validation, config, options, *args, **kwargs ):
124 
125  self.start = 0
126  self.end = args
127  self.JobId=[]
128  super(ValidationJob, self).__init__( validation, config, options )
129  self.validation = self.__getValidation( self.valType, self.valName,
130  self.alignments, config,
131  options )
132 
def __init__(self, validation, config, options, args, kwargs)
def __getValidation(self, valType, name, alignments, config, options)

Member Function Documentation

def validateAlignments.ValidationJob.__createJob (   self,
  jobMode,
  outpath 
)
private
This private method creates the needed files for the validation job.

Definition at line 202 of file validateAlignments.py.

References validateAlignments.ValidationBase.preexisting.

Referenced by validateAlignments.ValidationJob.createJob().

202  def __createJob( self, jobMode, outpath ):
203  """This private method creates the needed files for the validation job.
204  """
205  self.validation.createConfiguration( outpath )
206  if self.preexisting:
207  return
208  self.scripts = sum([addIndex(script, self.validation.NJobs) for script in self.validation.createScript( outpath )], [])
209  return None
210 
def addIndex(filename, njobs, index=None)
def __createJob(self, jobMode, outpath)
def validateAlignments.ValidationJob.__getValidation (   self,
  valType,
  name,
  alignments,
  config,
  options 
)
private

Definition at line 133 of file validateAlignments.py.

References split, and digitizers_cfi.strip.

133  def __getValidation( self, valType, name, alignments, config, options ):
134  if valType == "compare":
135  alignmentsList = alignments.split( "," )
136  firstAlignList = alignmentsList[0].split()
137  firstAlignName = firstAlignList[0].strip()
138  if firstAlignName == "IDEAL":
139  raise AllInOneError("'IDEAL' has to be the second (reference)"
140  " alignment in 'compare <val_name>: "
141  "<alignment> <reference>'.")
142  if len( firstAlignList ) > 1:
143  firstRun = firstAlignList[1]
144  elif config.has_section("IOV"):
145  firstRun = config.get("IOV", "iov")
146  else:
147  raise AllInOneError("Have to provide a run number for geometry comparison")
148  firstAlign = Alignment( firstAlignName, config, firstRun )
149  firstAlignName = firstAlign.name
150  secondAlignList = alignmentsList[1].split()
151  secondAlignName = secondAlignList[0].strip()
152  if secondAlignName == "IDEAL":
153  secondAlign = secondAlignName
154  else:
155  if len( secondAlignList ) > 1:
156  secondRun = secondAlignList[1]
157  elif config.has_section("IOV"):
158  secondRun = config.get("IOV", "iov")
159  else:
160  raise AllInOneError("Have to provide a run number for geometry comparison")
161  secondAlign = Alignment( secondAlignName, config,
162  secondRun )
163  secondAlignName = secondAlign.name
164 
165  validation = GeometryComparison( name, firstAlign, secondAlign,
166  config,
167  self.commandLineOptions.getImages)
168  elif valType == "offline":
169  validation = OfflineValidation( name,
170  Alignment( alignments.strip(), config ), config )
171  elif valType == "preexistingoffline":
172  validation = PreexistingOfflineValidation(name, config)
173  elif valType == "offlineDQM":
174  validation = OfflineValidationDQM( name,
175  Alignment( alignments.strip(), config ), config )
176  elif valType == "mcValidate":
177  validation = MonteCarloValidation( name,
178  Alignment( alignments.strip(), config ), config )
179  elif valType == "preexistingmcValidate":
180  validation = PreexistingMonteCarloValidation(name, config)
181  elif valType == "split":
182  validation = TrackSplittingValidation( name,
183  Alignment( alignments.strip(), config ), config )
184  elif valType == "preexistingsplit":
185  validation = PreexistingTrackSplittingValidation(name, config)
186  elif valType == "zmumu":
187  validation = ZMuMuValidation( name,
188  Alignment( alignments.strip(), config ), config )
189  elif valType == "primaryvertex":
190  validation = PrimaryVertexValidation( name,
191  Alignment( alignments.strip(), config ), config )
192  elif valType == "preexistingprimaryvertex":
193  validation = PreexistingPrimaryVertexValidation(name, self.__config)
194  elif valType == "overlap":
195  validation = OverlapValidation( name,
196  Alignment( alignments.strip(), self.__config ), self.__config )
197  else:
198  raise AllInOneError("Unknown validation mode '%s'"%valType)
199 
200  return validation
201 
def __getValidation(self, valType, name, alignments, config, options)
double split
Definition: MVATrainer.cc:139
def validateAlignments.ValidationJob.__iter__ (   self)

Definition at line 277 of file validateAlignments.py.

277  def __iter__(self):
278  yield self
279 
def validateAlignments.ValidationJob.__next__ (   self)

Definition at line 280 of file validateAlignments.py.

References validateAlignments.ValidationJob.end, svgfig.LineAxis.end, validateAlignments.ValidationJob.start, and svgfig.LineAxis.start.

280  def __next__(self):
281  if self.start >= len(self.end):
282  raise StopIteration
283  else:
284  self.start += 1
285  return self.end[self.start-1]
286 
287 
def validateAlignments.ValidationJob.createJob (   self)
This is the method called to create the job files.

Definition at line 211 of file validateAlignments.py.

References validateAlignments.ValidationJob.__createJob().

211  def createJob(self):
212  """This is the method called to create the job files."""
213  self.__createJob( self.validation.jobmode,
214  os.path.abspath( self.commandLineOptions.Name) )
215 
def __createJob(self, jobMode, outpath)
def validateAlignments.ValidationJob.getValidation (   self)
def validateAlignments.ValidationJob.needsproxy (   self)

Definition at line 274 of file validateAlignments.py.

References validateAlignments.ValidationBase.preexisting.

274  def needsproxy(self):
275  return self.validation.needsproxy and not self.preexisting and not self.commandLineOptions.dryRun
276 
def validateAlignments.ValidationJob.runJob (   self)

Definition at line 216 of file validateAlignments.py.

References mps_setup.append, helperFunctions.getCommandOutput2(), validateAlignments.ValidationBase.preexisting, edm.print(), validateAlignments.ValidationJob.scripts, validateAlignments.ValidationBase.valName, monteCarloValidation.MonteCarloValidation.valType, trackSplittingValidation.TrackSplittingValidation.valType, overlapValidation.OverlapValidation.valType, primaryVertexValidation.PrimaryVertexValidation.valType, offlineValidation.OfflineValidation.valType, zMuMuValidation.ZMuMuValidation.valType, geometryComparison.GeometryComparison.valType, and validateAlignments.ValidationBase.valType.

216  def runJob( self ):
217  general = self.config.getGeneral()
218  log = ""
219 
220  if self.preexisting:
221  if self.validation.config.has_section("IOV"):
222  iov = self.validation.config.get("IOV", "iov")
223  else:
224  iov = "singleIOV"
225  preexistingValType = self.valType
226  originalValType = preexistingValType.replace('preexisting', '')
227  key = (originalValType, self.validation.originalValName, iov)
228  if key in ValidationJob.condorConf:
229  ValidationJob.condorConf[key].append(("preexisting", "", general["logdir"]))
230  else:
231  ValidationJob.condorConf[key] = [("preexisting", "", general["logdir"])]
232  log = "> " + self.validation.name + " is already validated."
233  return log
234 
235  for script in self.scripts:
236  name = os.path.splitext( os.path.basename( script) )[0]
237  ValidationJob.jobCount += 1
238  if self.commandLineOptions.dryRun:
239  print("%s would run: %s"%( name, os.path.basename( script) ))
240  continue
241  log = "> Validating "+name
242  print("> Validating "+name)
243  if self.validation.jobmode == "interactive":
244  log += getCommandOutput2( script )
245  ValidationJob.interactCount += 1
246  elif self.validation.jobmode.split( "," )[0] == "condor":
247  if self.validation.config.has_section("IOV"):
248  iov = self.validation.config.get("IOV", "iov")
249  else:
250  iov = "singleIOV"
251  scriptPaths = script.split("/")
252  scriptName = scriptPaths[-1]
253  scriptName = scriptName.split(".")
254  jobName = "%s"%scriptName[0] + "_%s"%scriptName[1]+"_%s"%scriptName[2]
255  key = (self.valType, self.valName, iov)
256  if key in ValidationJob.condorConf:
257  ValidationJob.condorConf[key].append((jobName, script, general["logdir"]))
258  else:
259  ValidationJob.condorConf[key] = [(jobName, script, general["logdir"])]
260  else:
261  raise AllInOneError("Unknown 'jobmode'!\n"
262  "Please change this parameter either in "
263  "the [general] or in the ["
264  + self.valType + ":" + self.valName
265  + "] section to one of the following "
266  "values:\n"
267  "\tinteractive\n\tcondor, -q <queue>\n")
268 
269  return log
270 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def getCommandOutput2(command)

Member Data Documentation

validateAlignments.ValidationJob.condorConf
static

Definition at line 121 of file validateAlignments.py.

validateAlignments.ValidationJob.end
validateAlignments.ValidationJob.interactCount
static

Definition at line 119 of file validateAlignments.py.

validateAlignments.ValidationJob.jobCount
static

Definition at line 120 of file validateAlignments.py.

validateAlignments.ValidationJob.JobId

Definition at line 127 of file validateAlignments.py.

validateAlignments.ValidationJob.scripts

Definition at line 208 of file validateAlignments.py.

Referenced by validateAlignments.ValidationJob.runJob().

validateAlignments.ValidationJob.start
validateAlignments.ValidationJob.validation