114 def run(self, test: WorkflowTest) -> bool:
115 self.logger.
info(
"---------------------------------------------------------------------------------------")
116 self.logger.
info(f
"Running {test.ID} Frozen Tier0 Policy Check on {self.format} for {self.max_events} events")
118 diff_rules_path: Path = self.setup.diff_rules_path
119 diff_rules_exclusion_filename: str = f
"{test.ID}_{self.format}_diff-exclusion-list.txt"
120 diff_rules_interest_filename: str = f
"{test.ID}_{self.format}_diff-interest-list.txt"
121 diff_rules_file =
None
123 file_name = f
"my{self.format}.pool.root"
124 if test.type == WorkflowType.Derivation:
125 file_name = f
"{self.format}.myOutput.pool.root"
126 reference_file = self.reference_file(test, file_name)
127 if reference_file
is None:
128 self.logger.
error(f
"Reference file {file_name} not found")
131 if self.setup.validation_only:
132 cvmfs_path = Path(references_CVMFS_path)
133 diff_rules_path = cvmfs_path / self.setup.release_ID / test.ID
135 self.logger.
info(f
"Reading the reference file from location {reference_file}")
138 branches_of_interest =
False
139 if self.setup.diff_rules_path
is None:
140 diff_rules_exclusion_local_path = test.validation_path / diff_rules_exclusion_filename
141 diff_rules_interest_local_path = test.validation_path / diff_rules_interest_filename
142 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()
143 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()
144 if not diff_rules_exclusion_local_path.exists()
and not diff_rules_interest_local_path.exists():
145 self.logger.
info(f
"Neither '{diff_rules_exclusion_local_path}' nor '{diff_rules_interest_local_path}' files exist in the release.")
146 elif diff_rules_exclusion_local_path.exists():
147 diff_rules_file = diff_rules_exclusion_local_path
148 elif diff_rules_interest_local_path.exists():
149 diff_rules_file = diff_rules_interest_local_path
150 branches_of_interest =
True
152 if diff_rules_file
is None and diff_rules_path
is not None:
153 diff_rules_file = diff_rules_path / diff_rules_exclusion_filename
154 if not diff_rules_file.exists():
155 diff_rules_file = diff_rules_path / diff_rules_interest_filename
156 if diff_rules_file.exists():
157 branches_of_interest =
True
159 if diff_rules_file
is not None and diff_rules_file.exists():
160 self.logger.
info(f
"Reading the diff rules file from location {diff_rules_file}")
162 with diff_rules_file.open()
as f:
164 stripped_line = line.rstrip()
165 if stripped_line
and stripped_line[0] !=
'#':
166 diff_root_list.append(
r"'{}'".
format(stripped_line))
168 self.logger.
info(
"No diff rules file exists, using the default list")
169 diff_root_list = [
r"'index_ref'",
r"'(.*)_timings(.*)'",
r"'(.*)_mems(.*)'"]
171 validation_file = test.validation_path / file_name
172 log_file = test.validation_path / f
"diff-root-{test.ID}.{self.format}.log"
173 diff_root_list =
" ".
join(diff_root_list)
174 diff_root_mode =
"--branches-of-interest" if branches_of_interest
else "--ignore-leaves"
176 comparison_mode =
"detailed" if self.detailed_comparison
else "semi-detailed"
177 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} > {log_file} 2>&1"
178 output, error = subprocess.Popen([
"/bin/bash",
"-c", comparison_command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
179 output, error = output.decode(
"utf-8"), error.decode(
"utf-8")
184 passed_frozen_tier0_test =
True
186 with log_file.open()
as file:
188 if "WARNING" in line:
189 self.logger.
error(line.strip())
190 passed_frozen_tier0_test =
False
191 if "leaves differ" in line:
192 self.logger.
error(line.strip())
193 passed_frozen_tier0_test =
False
195 self.logger.
error(line.strip())
196 passed_frozen_tier0_test =
False
197 if "INFO all good." in line:
200 result = passed_frozen_tier0_test
and all_good
202 self.logger.
info(
"Passed!\n")
205 if self.setup.disable_release_setup:
206 self.logger.
print(f
"ATLAS-CI-ADD-LABEL: {test.run.value}-{test.type.value}-output-changed")
207 self.logger.
print(
"")
209 if "DAOD" in self.format:
210 self.logger.
error(f
"Your change breaks the frozen derivation policy in test {test.ID}.")
211 self.logger.
error(
"Please make sure you explain the reason for the change and ask relevant experts for approval.")
213 self.logger.
error(f
"Your change breaks the frozen tier0 policy in test {test.ID}.")
214 self.logger.
error(
"Please make sure this has been discussed in the correct meeting (RIG or Simulation) meeting and approved by the relevant experts.")
217 if self.setup.disable_release_setup:
218 comparison_command = f
"CopyCIArtifact.sh {validation_file}"
219 output, error = subprocess.Popen([
"/bin/bash",
"-c", comparison_command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
220 output, error = output.decode(
"utf-8"), error.decode(
"utf-8")
222 if error
or not output:
223 self.logger.
error(f
"Tried copying '{validation_file}' to the CI artifacts area but it failed.")
224 self.logger.
error(f
" {error.strip()}")
226 self.logger.
error(output)
228 with log_file.open()
as file:
230 self.logger.
info(f
" {line.strip()}")
231 self.logger.
info(
"-----------------------------------------------------\n")