ATLAS Offline Software
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
python.Checks.FPECheck Class Reference
Inheritance diagram for python.Checks.FPECheck:
Collaboration diagram for python.Checks.FPECheck:

Public Member Functions

def run (self, WorkflowTest test)
 
Optional[Path] reference_file (self, "WorkflowTest" test, str file_name)
 

Public Attributes

 setup
 
 logger
 

Static Public Attributes

 ignoreTestRuns
 
 ignoreTestTypes
 
 ignoreTestIDs
 

Detailed Description

Run FPE check.

Definition at line 580 of file Checks.py.

Member Function Documentation

◆ reference_file()

Optional[Path] python.Test.WorkflowCheck.reference_file (   self,
"WorkflowTest"  test,
str  file_name 
)
inherited

Definition at line 91 of file Tools/WorkflowTestRunner/python/Test.py.

91  def reference_file(self, test: "WorkflowTest", file_name: str) -> Optional[Path]:
92  reference_path: Path = test.reference_path
93  reference_file = reference_path / file_name
94 
95  # Read references from CVMFS
96  if self.setup.validation_only:
97  # Resolve the subfolder first. Results are stored like: main_folder/branch/test/version/.
98  reference_revision = references_map[f"{test.ID}"]
99  cvmfs_path = Path(references_CVMFS_path)
100  rel_path = Path(self.setup.release_ID) / test.ID / reference_revision
101  reference_path = cvmfs_path / rel_path
102  reference_file = reference_path / file_name
103 
104  if not reference_path.exists():
105  self.logger.error(f"CVMFS reference location {reference_path} does not exist!")
106  return None
107 
108  if references_override_url is not None:
109  import requests
110 
111  url = references_override_url
112  if not url.endswith("/"): url += "/"
113  url += str(rel_path / file_name)
114  self.logger.info("Checking for reference override at %s", url)
115  if requests.head(url).ok: # file exists at url
116  reference_file = Path.cwd() / f"reference_{file_name}"
117  self.logger.info("Downloading reference from %s to %s", url, reference_file)
118  r = requests.get(url, stream=True)
119  with reference_file.open('wb') as f:
120  for chunk in r.iter_content(chunk_size=1024):
121  if chunk: # filter out keep-alive new chunks
122  f.write(chunk)
123  else:
124  self.logger.info("No reference override found")
125 
126  return reference_file
127 
128 

◆ run()

def python.Checks.FPECheck.run (   self,
WorkflowTest  test 
)

Definition at line 588 of file Checks.py.

588  def run(self, test: WorkflowTest):
589  self.logger.info("-----------------------------------------------------")
590  self.logger.info(f"Running {test.ID} FPE Check")
591 
592  result = True
593  for step in test.steps:
594  log = test.validation_path / f"log.{step}"
595  fpes = {}
596  stack_traces = {}
597  with log.open() as file:
598  last_stack_trace = None
599  for line in file:
600  if "WARNING FPE" in line:
601  last_stack_trace = None
602  fpe = None
603  for part in reversed(line.split()):
604  if "[" in part:
605  fpe = part.strip().replace("[", "").replace("]", "")
606  break
607  if fpe:
608  if fpe in fpes:
609  fpes[fpe] += 1
610  else:
611  fpes[fpe] = 1
612  last_stack_trace = []
613  stack_traces[fpe] = last_stack_trace
614  elif "FPE stacktrace" in line and last_stack_trace is not None:
615  line = next(file)
616  last_stack_trace.append(line.strip()[9:])
617 
618  if fpes.keys():
619  msgLvl = logging.WARNING if test.run in self.ignoreTestRuns or test.type in self.ignoreTestTypes or test.ID in self.ignoreTestIDs else logging.ERROR
620  result = False
621  self.logger.log(msgLvl, f" {step} validation test step FPEs")
622  for fpe, count in sorted(fpes.items(), key=lambda item: item[1]):
623  self.logger.log(msgLvl, f"{count:>5} {fpe}")
624  for fpe in fpes.keys():
625  self.logger.log(msgLvl, "-----------------------------------------------------")
626  self.logger.log(msgLvl, f" first stack trace for algorithm {fpe}:")
627  for line in stack_traces[fpe]:
628  self.logger.log(msgLvl, line)
629  self.logger.log(msgLvl, "-----------------------------------------------------")
630 
631  if result:
632  self.logger.info("Passed!\n")
633  elif test.run in self.ignoreTestRuns or test.type in self.ignoreTestTypes or test.ID in self.ignoreTestIDs:
634  self.logger.warning("Failed!")
635  self.logger.warning("Check disabled due to irreproducibilities!\n")
636  result = True
637  else:
638  self.logger.error("Failed!\n")
639 
640  return result

Member Data Documentation

◆ ignoreTestIDs

python.Checks.FPECheck.ignoreTestIDs
static

Definition at line 586 of file Checks.py.

◆ ignoreTestRuns

python.Checks.FPECheck.ignoreTestRuns
static

Definition at line 584 of file Checks.py.

◆ ignoreTestTypes

python.Checks.FPECheck.ignoreTestTypes
static

Definition at line 585 of file Checks.py.

◆ logger

python.Test.WorkflowCheck.logger
inherited

Definition at line 89 of file Tools/WorkflowTestRunner/python/Test.py.

◆ setup

python.Test.WorkflowCheck.setup
inherited

Definition at line 88 of file Tools/WorkflowTestRunner/python/Test.py.


The documentation for this class was generated from the following file:
grepfile.info
info
Definition: grepfile.py:38
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
str
Definition: BTagTrackIpAccessor.cxx:11
error
Definition: IImpactPoint3dEstimator.h:70