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

Public Member Functions

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

Public Attributes

 setup = setup
 logger = setup.logger

Detailed Description

Run WARNINGS check.

Definition at line 538 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.WarningsComparisonCheck.run ( self,
WorkflowTest test )

Definition at line 541 of file Checks.py.

541 def run(self, test: WorkflowTest):
542 self.logger.info("-----------------------------------------------------")
543 self.logger.info(f"Running {test.ID} WARNINGS Check\n")
544
545 result = True
546 for step in test.steps:
547 log_name = f"log.{step}"
548 reference_log = test.reference_path / log_name
549 validation_log = test.validation_path / log_name
550 warnings_reference = warnings_count(reference_log)
551 warnings_validation = warnings_count (validation_log)
552
553 wr=[]
554 for w in warnings_reference:
555 wr.append(w[9:])
556 wv=[]
557 for w in warnings_validation:
558 wv.append(w[9:])
559
560 wn = list(set(wv)-set(wr))
561 wo = list(set(wr)-set(wv))
562
563
564 if len(warnings_validation) > len(warnings_reference):
565 self.logger.error(f"Validation log file {validation_log} has {len(warnings_validation) - len(warnings_reference)} more warning(s) than the reference log file {reference_log}")
566 self.logger.error("Please remove the new warning message(s):")
567 for w in wn:
568 self.logger.error(w)
569 result = False
570 elif len(warnings_validation) < len(warnings_reference):
571 self.logger.info(f"Validation log file {validation_log} has {len(warnings_reference) - len(warnings_validation)} less warnings than the reference log file {reference_log}")
572 self.logger.info("The reduction of unnecessary WARNINGs is much appreciated. Is it expected?")
573 self.logger.info("The following warning messages have been removed:")
574 for w in wo:
575 self.logger.info(w)
576 result = True
577 else :
578 self.logger.info(f"Validation log file {validation_log} has the same number of warnings as the reference log file {reference_log}")
579 result = True
580
581 if result:
582 self.logger.info("Passed!\n")
583 else :
584 self.logger.error("Failed!\n")
585
586 return result
587
588
STL class.
int run(int argc, char *argv[])

Member Data Documentation

◆ 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: