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

Public Member Functions

def __init__ (self, name='MessageCount')
 
def configure (self, test)
 
def run (self, dry_run=False)
 

Public Attributes

 executable
 
 log_regex
 
 skip_logs
 
 start_pattern
 
 end_pattern
 
 print_on_fail
 
 thresholds
 
 auto_report_result
 
 depends_on_exec
 
 result
 

Detailed Description

Count messages printed inside event loop

Definition at line 624 of file CheckSteps.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TrigValSteering.CheckSteps.MessageCountStep.__init__ (   self,
  name = 'MessageCount' 
)

Definition at line 627 of file CheckSteps.py.

627  def __init__(self, name='MessageCount'):
628  super(MessageCountStep, self).__init__(name)
629  self.executable = 'messageCounter.py'
630  self.log_regex = r'(athena\.(?!.*tail).*log$|athenaHLT:.*\.out$|^log\.(.*to.*|Derivation))'
631  self.skip_logs = []
632  self.start_pattern = r'(HltEventLoopMgr|AthenaHiveEventLoopMgr).*INFO Starting loop on events'
633  self.end_pattern = r'(HltEventLoopMgr.*INFO All events processed|AthenaHiveEventLoopMgr.*INFO.*Loop Finished)'
634  self.print_on_fail = None
635  self.thresholds = {}
636  self.auto_report_result = True
637  self.depends_on_exec = True # skip if ExecSteps failed
638 

Member Function Documentation

◆ configure()

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

Definition at line 639 of file CheckSteps.py.

639  def configure(self, test):
640  self.args += ' -s "{:s}"'.format(self.start_pattern)
641  self.args += ' -e "{:s}"'.format(self.end_pattern)
642  if self.print_on_fail is None:
643  self.print_on_fail = self.required
644  if self.print_on_fail:
645  self.args += ' --saveAll'
646 
647  max_events = test.exec_steps[0].max_events if isinstance(test.exec_steps[0], ExecStep) else 0
648  if 'WARNING' not in self.thresholds:
649  self.thresholds['WARNING'] = 0
650  if 'INFO' not in self.thresholds:
651  self.thresholds['INFO'] = max_events
652  if 'DEBUG' not in self.thresholds:
653  self.thresholds['DEBUG'] = 0
654  if 'VERBOSE' not in self.thresholds:
655  self.thresholds['VERBOSE'] = 0
656  if 'other' not in self.thresholds:
657  self.thresholds['other'] = max_events
658  super(MessageCountStep, self).configure(test)
659 

◆ run()

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

Definition at line 660 of file CheckSteps.py.

660  def run(self, dry_run=False):
661  files = os.listdir('.')
662  r = re.compile(self.log_regex)
663  log_files = [f for f in filter(r.match, files) if f not in self.skip_logs]
664  if not log_files and not dry_run:
665  self.log.error('%s found no log files matching the pattern %s', self.name, self.log_regex)
666  self.result = 1
667  if self.auto_report_result:
668  self.report_result()
669  return self.result, '# (internal) {} -> failed'.format(self.name)
670  self.args += ' ' + ' '.join(log_files)
671  auto_report = self.auto_report_result
672  self.auto_report_result = False
673  ret, cmd = super(MessageCountStep, self).run(dry_run)
674  self.auto_report_result = auto_report
675  if ret != 0:
676  self.log.error('%s failed', self.name)
677  self.result = 1
678  if self.auto_report_result:
679  self.report_result()
680  return self.result, cmd
681 
682  for log_file in log_files:
683  json_file = 'MessageCount.{:s}.json'.format(log_file)
684  if self.print_on_fail:
685  all_json_file = 'Messages.{:s}.json'.format(log_file)
686  if not os.path.isfile(json_file):
687  self.log.warning('%s cannot open file %s', self.name, json_file)
688  with open(json_file) as f:
689  summary = json.load(f)
690  for level, threshold in self.thresholds.items():
691  if summary[level] > threshold:
692  self.result += 1
693  self.log.info(
694  '%s Number of %s messages %s in %s is higher than threshold %s',
695  self.name, level, summary[level], log_file, threshold)
696  if self.print_on_fail:
697  self.log.info('%s Printing all %s messages from %s', self.name, level, log_file)
698  with open(all_json_file) as af:
699  all_msg = json.load(af)
700  for msg in all_msg[level]:
701  print(msg.strip()) # noqa: ATL901
702 
703  if self.auto_report_result:
704  self.report_result()
705  return self.result, cmd
706 
707 

Member Data Documentation

◆ auto_report_result

python.TrigValSteering.CheckSteps.MessageCountStep.auto_report_result

Definition at line 636 of file CheckSteps.py.

◆ depends_on_exec

python.TrigValSteering.CheckSteps.MessageCountStep.depends_on_exec

Definition at line 637 of file CheckSteps.py.

◆ end_pattern

python.TrigValSteering.CheckSteps.MessageCountStep.end_pattern

Definition at line 633 of file CheckSteps.py.

◆ executable

python.TrigValSteering.CheckSteps.MessageCountStep.executable

Definition at line 629 of file CheckSteps.py.

◆ log_regex

python.TrigValSteering.CheckSteps.MessageCountStep.log_regex

Definition at line 630 of file CheckSteps.py.

◆ print_on_fail

python.TrigValSteering.CheckSteps.MessageCountStep.print_on_fail

Definition at line 634 of file CheckSteps.py.

◆ result

python.TrigValSteering.CheckSteps.MessageCountStep.result

Definition at line 666 of file CheckSteps.py.

◆ skip_logs

python.TrigValSteering.CheckSteps.MessageCountStep.skip_logs

Definition at line 631 of file CheckSteps.py.

◆ start_pattern

python.TrigValSteering.CheckSteps.MessageCountStep.start_pattern

Definition at line 632 of file CheckSteps.py.

◆ thresholds

python.TrigValSteering.CheckSteps.MessageCountStep.thresholds

Definition at line 635 of file CheckSteps.py.


The documentation for this class was generated from the following file:
grepfile.info
info
Definition: grepfile.py:38
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
covarianceTool.filter
filter
Definition: covarianceTool.py:514
run
Definition: run.py:1
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
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
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
error
Definition: IImpactPoint3dEstimator.h:70