ATLAS Offline Software
Loading...
Searching...
No Matches
python.Checks.FPECheck Class Reference
Inheritance diagram for python.Checks.FPECheck:
Collaboration diagram for python.Checks.FPECheck:

Public Member Functions

 run (self, WorkflowTest test)
Path|None reference_file (self, "WorkflowTest" test, str file_name)

Public Attributes

 setup = setup
 logger = setup.logger

Static Public Attributes

list ignoreTestRuns = []
list ignoreTestTypes = [WorkflowType.FullSim, WorkflowType.AF3]
list ignoreTestIDs = ['x686']

Detailed Description

Run FPE check.

Definition at line 589 of file Checks.py.

Member Function Documentation

◆ reference_file()

Path | None python.Test.WorkflowCheck.reference_file ( self,
"WorkflowTest" test,
str file_name )
inherited

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

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

◆ run()

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

Definition at line 597 of file Checks.py.

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

Member Data Documentation

◆ ignoreTestIDs

list python.Checks.FPECheck.ignoreTestIDs = ['x686']
static

Definition at line 595 of file Checks.py.

◆ ignoreTestRuns

list python.Checks.FPECheck.ignoreTestRuns = []
static

Definition at line 593 of file Checks.py.

◆ ignoreTestTypes

list python.Checks.FPECheck.ignoreTestTypes = [WorkflowType.FullSim, WorkflowType.AF3]
static

Definition at line 594 of file Checks.py.

◆ logger

python.Test.WorkflowCheck.logger = setup.logger
inherited

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

◆ setup

python.Test.WorkflowCheck.setup = setup
inherited

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


The documentation for this class was generated from the following file: