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 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 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 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
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310
Definition run.py:1

Member Data Documentation

◆ ignoreTestIDs

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

Definition at line 586 of file Checks.py.

◆ ignoreTestRuns

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

Definition at line 584 of file Checks.py.

◆ ignoreTestTypes

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

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