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

Public Member Functions

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

Public Attributes

 setup
 
 logger
 

Detailed Description

Run WARNINGS check.

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

Definition at line 532 of file Checks.py.

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

Member Data Documentation

◆ 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
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
python.Helpers.warnings_count
List[str] warnings_count(Path file_name)
Definition: Tools/WorkflowTestRunner/python/Helpers.py:69
str
Definition: BTagTrackIpAccessor.cxx:11
error
Definition: IImpactPoint3dEstimator.h:70