111 def run(self, test: WorkflowTest) -> bool:
112 self.
logger.info(
"---------------------------------------------------------------------------------------")
113 self.
logger.info(f
"Running {test.ID} Frozen Tier0 Policy Check on {self.format} for {self.max_events} events")
115 diff_rules_path: Path = self.
setup.diff_rules_path
116 diff_rules_exclusion_filename: str = f
"{test.ID}_{self.format}_diff-exclusion-list.txt"
117 diff_rules_interest_filename: str = f
"{test.ID}_{self.format}_diff-interest-list.txt"
118 diff_rules_file =
None
120 file_name = f
"my{self.format}.pool.root"
121 if test.type == WorkflowType.Derivation:
122 file_name = f
"{self.format}.myOutput.pool.root"
124 if reference_file
is None:
125 self.
logger.
error(f
"Reference file {file_name} not found")
128 if self.
setup.validation_only:
129 cvmfs_path = Path(references_CVMFS_path)
130 diff_rules_path = cvmfs_path / self.
setup.release_ID / test.ID
132 self.
logger.info(f
"Reading the reference file from location {reference_file}")
135 branches_of_interest =
False
136 if self.
setup.diff_rules_path
is None:
137 diff_rules_exclusion_local_path = test.validation_path / diff_rules_exclusion_filename
138 diff_rules_interest_local_path = test.validation_path / diff_rules_interest_filename
139 subprocess.Popen([
"/bin/bash",
"-c", f
"cd {test.validation_path}; get_files -remove -data {diff_rules_exclusion_filename}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
140 subprocess.Popen([
"/bin/bash",
"-c", f
"cd {test.validation_path}; get_files -remove -data {diff_rules_interest_filename}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
141 if not diff_rules_exclusion_local_path.exists()
and not diff_rules_interest_local_path.exists():
142 self.
logger.info(f
"Neither '{diff_rules_exclusion_local_path}' nor '{diff_rules_interest_local_path}' files exist in the release.")
143 elif diff_rules_exclusion_local_path.exists():
144 diff_rules_file = diff_rules_exclusion_local_path
145 elif diff_rules_interest_local_path.exists():
146 diff_rules_file = diff_rules_interest_local_path
147 branches_of_interest =
True
149 if diff_rules_file
is None and diff_rules_path
is not None:
150 diff_rules_file = diff_rules_path / diff_rules_exclusion_filename
151 if not diff_rules_file.exists():
152 diff_rules_file = diff_rules_path / diff_rules_interest_filename
153 if diff_rules_file.exists():
154 branches_of_interest =
True
156 if diff_rules_file
is not None and diff_rules_file.exists():
157 self.
logger.info(f
"Reading the diff rules file from location {diff_rules_file}")
159 with diff_rules_file.open()
as f:
161 stripped_line = line.rstrip()
162 if stripped_line
and stripped_line[0] !=
'#':
163 diff_root_list.append(rf
"'{stripped_line}'")
165 self.
logger.info(
"No diff rules file exists, using the default list")
166 diff_root_list = [
r"'index_ref'"]
169 self.
logger.info(f
"Reading the tolerances from location {test.diff_tolerances}")
171 self.
logger.info(
"Default diff-root tolerances will be used")
173 validation_file = test.validation_path / file_name
174 log_file = test.validation_path / f
"diff-root-{test.ID}.{self.format}.log"
175 diff_root_list =
" ".join(diff_root_list)
176 diff_root_mode =
"--branches-of-interest" if branches_of_interest
else "--ignore-leaves"
177 tolerances_mode = f
"--tolerances @{test.diff_tolerances}" if self.
allow_tolerance and test.diff_tolerances
is not None else ""
180 comparison_command = f
"acmd.py diff-root {reference_file} {validation_file} --order-trees --nan-equal --exact-branches --mode {comparison_mode} --error-mode resilient {diff_root_mode} {diff_root_list} --entries {self.max_events} {tolerances_mode} > {log_file} 2>&1"
181 output, error = subprocess.Popen([
"/bin/bash",
"-c", comparison_command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
182 output, error = output.decode(
"utf-8"), error.decode(
"utf-8")
187 passed_frozen_tier0_test =
True
189 with log_file.open()
as file:
191 if "WARNING" in line:
193 passed_frozen_tier0_test =
False
194 if "leaves differ" in line:
196 passed_frozen_tier0_test =
False
199 passed_frozen_tier0_test =
False
200 if "INFO all good." in line:
203 result = passed_frozen_tier0_test
and all_good
205 self.
logger.info(
"Passed!\n")
208 if self.
setup.disable_release_setup:
209 self.
logger.
print(f
"ATLAS-CI-ADD-LABEL: {test.run.value}-{test.type.value}-output-changed")
213 self.
logger.
error(f
"Your change breaks the frozen derivation policy in test {test.ID}.")
214 self.
logger.
error(
"Please make sure you explain the reason for the change and ask relevant experts for approval.")
216 self.
logger.
error(f
"Your change affects standard outputs in test {test.ID}.")
217 self.
logger.
error(
"Please make sure you explain the reason for the change and ask relevant experts for approval.")
220 if self.
setup.disable_release_setup:
221 comparison_command = f
"CopyCIArtifact.sh {validation_file}"
222 output, error = subprocess.Popen([
"/bin/bash",
"-c", comparison_command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
223 output, error = output.decode(
"utf-8"), error.decode(
"utf-8")
225 if error
or not output:
226 self.
logger.
error(f
"Tried copying '{validation_file}' to the CI artifacts area but it failed.")
231 with log_file.open()
as file:
233 self.
logger.info(f
" {line.strip()}")
234 self.
logger.info(
"-----------------------------------------------------\n")