ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.TrigValSteering.CheckSteps.RegTestStep Class Reference
Inheritance diagram for python.TrigValSteering.CheckSteps.RegTestStep:
Collaboration diagram for python.TrigValSteering.CheckSteps.RegTestStep:

Public Member Functions

def __init__ (self, name='RegTest')
 
def configure (self, test)
 
def prepare_inputs (self)
 
def rename_ref (self)
 
def run (self, dry_run=False)
 

Public Attributes

 regex
 
 executable
 
 input_base_name
 
 auto_report_result
 
 output_stream
 
 input_file
 
 result
 
 reference
 
 ref_test_name
 
 explicit_reference
 

Detailed Description

Execute RegTest comparing a log file against a reference

Definition at line 293 of file CheckSteps.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TrigValSteering.CheckSteps.RegTestStep.__init__ (   self,
  name = 'RegTest' 
)

Reimplemented from python.TrigValSteering.CheckSteps.RefComparisonStep.

Definition at line 296 of file CheckSteps.py.

296  def __init__(self, name='RegTest'):
297  super(RegTestStep, self).__init__(name)
298  self.regex = 'REGTEST'
299  self.executable = 'diff'
300  self.input_base_name = 'athena'
301  self.auto_report_result = True
302  self.output_stream = Step.OutputStream.FILE_AND_STDOUT
303 

Member Function Documentation

◆ configure()

def python.TrigValSteering.CheckSteps.RegTestStep.configure (   self,
  test 
)

Reimplemented from python.TrigValSteering.CheckSteps.RefComparisonStep.

Definition at line 304 of file CheckSteps.py.

304  def configure(self, test):
305  self.input_file = self.input_base_name+'.regtest'
306  RefComparisonStep.configure(self, test)
307  self.args += ' -U 2 -b {} {}'.format(self.input_file, self.reference)
308  Step.configure(self, test)
309 

◆ prepare_inputs()

def python.TrigValSteering.CheckSteps.RegTestStep.prepare_inputs (   self)

Definition at line 310 of file CheckSteps.py.

310  def prepare_inputs(self):
311  log_file = self.input_base_name+'.log'
312  if not os.path.isfile(log_file):
313  self.log.error('%s input file %s is missing', self.name, log_file)
314  return False
315  with open(log_file, encoding='utf-8') as f_in:
316  matches = re.findall('({}.*).*$'.format(self.regex),
317  f_in.read(), re.MULTILINE)
318  with open(self.input_file, 'w', encoding='utf-8') as f_out:
319  for line in matches:
320  linestr = str(line[0]) if type(line) is tuple else line
321  f_out.write(linestr+'\n')
322  return True
323 

◆ rename_ref()

def python.TrigValSteering.CheckSteps.RegTestStep.rename_ref (   self)

Definition at line 324 of file CheckSteps.py.

324  def rename_ref(self):
325  try:
326  if self.reference:
327  new_name = os.path.basename(self.reference) + '.new'
328  else:
329  new_name = os.path.basename(self.input_file) + '.new'
330  os.rename(self.input_file, new_name)
331  self.log.debug('Renamed %s to %s', self.input_file, new_name)
332  except OSError:
333  self.log.warning('Failed to rename %s to %s',
334  self.input_file, new_name)
335 

◆ run()

def python.TrigValSteering.CheckSteps.RegTestStep.run (   self,
  dry_run = False 
)

Definition at line 336 of file CheckSteps.py.

336  def run(self, dry_run=False):
337  if not dry_run and not self.prepare_inputs():
338  self.log.error('%s failed in prepare_inputs()', self.name)
339  self.result = 1
340  if self.auto_report_result:
341  self.report_result()
342  return self.result, '# (internal) {} -> failed'.format(self.name)
343  if self.reference is None:
344  self.log.error('Missing reference for %s', self.name)
345  if not dry_run:
346  self.rename_ref()
347  self.result = 999
348  if self.auto_report_result:
349  self.report_result()
350  return self.result, '# (internal) {} -> failed'.format(self.name)
351  retcode, cmd = super(RegTestStep, self).run(dry_run)
352  if not dry_run:
353  self.rename_ref()
354  return retcode, cmd
355 
356 

Member Data Documentation

◆ auto_report_result

python.TrigValSteering.CheckSteps.RegTestStep.auto_report_result

Definition at line 301 of file CheckSteps.py.

◆ executable

python.TrigValSteering.CheckSteps.RegTestStep.executable

Definition at line 299 of file CheckSteps.py.

◆ explicit_reference

python.TrigValSteering.CheckSteps.RefComparisonStep.explicit_reference
inherited

Definition at line 27 of file CheckSteps.py.

◆ input_base_name

python.TrigValSteering.CheckSteps.RegTestStep.input_base_name

Definition at line 300 of file CheckSteps.py.

◆ input_file

python.TrigValSteering.CheckSteps.RegTestStep.input_file

Definition at line 305 of file CheckSteps.py.

◆ output_stream

python.TrigValSteering.CheckSteps.RegTestStep.output_stream

Definition at line 302 of file CheckSteps.py.

◆ ref_test_name

python.TrigValSteering.CheckSteps.RefComparisonStep.ref_test_name
inherited

Definition at line 25 of file CheckSteps.py.

◆ reference

python.TrigValSteering.CheckSteps.RefComparisonStep.reference
inherited

Definition at line 24 of file CheckSteps.py.

◆ regex

python.TrigValSteering.CheckSteps.RegTestStep.regex

Definition at line 298 of file CheckSteps.py.

◆ result

python.TrigValSteering.CheckSteps.RegTestStep.result

Definition at line 339 of file CheckSteps.py.


The documentation for this class was generated from the following file:
vtune_athena.format
format
Definition: vtune_athena.py:14
configure
bool configure(asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > &tool, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronEffToolsHandles, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronSFToolsHandles, ToolHandleArray< CP::IMuonTriggerScaleFactors > &muonToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonEffToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonSFToolsHandles, const std::string &triggers, const std::map< std::string, std::string > &legsPerTool, unsigned long nToys, bool debug)
Definition: TrigGlobEffCorrValidation.cxx:514
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
run
Definition: run.py:1
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Trk::open
@ open
Definition: BinningType.h:40
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
str
Definition: BTagTrackIpAccessor.cxx:11
error
Definition: IImpactPoint3dEstimator.h:70