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)
Optional[Path] 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 586 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 93 of file Tools/WorkflowTestRunner/python/Test.py.

93 def reference_file(self, test: "WorkflowTest", file_name: str) -> Optional[Path]:
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 594 of file Checks.py.

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

Member Data Documentation

◆ ignoreTestIDs

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

Definition at line 592 of file Checks.py.

◆ ignoreTestRuns

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

Definition at line 590 of file Checks.py.

◆ ignoreTestTypes

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

Definition at line 591 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: