Run metadata check.
Definition at line 236 of file Checks.py.
◆ __init__()
None python.Checks.MetadataCheck.__init__ |
( |
|
self, |
|
|
TestSetup |
setup, |
|
|
str |
input_format |
|
) |
| |
Definition at line 239 of file Checks.py.
239 def __init__(self, setup: TestSetup, input_format: str) ->
None:
241 self.format = input_format
◆ 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
96 if self.setup.validation_only:
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
104 if not reference_path.exists():
105 self.logger.
error(f
"CVMFS reference location {reference_path} does not exist!")
108 if references_override_url
is not None:
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:
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):
124 self.logger.
info(
"No reference override found")
126 return reference_file
◆ run()
bool python.Checks.MetadataCheck.run |
( |
|
self, |
|
|
WorkflowTest |
test |
|
) |
| |
Definition at line 243 of file Checks.py.
243 def run(self, test: WorkflowTest) -> bool:
244 self.logger.
info(
"---------------------------------------------------------------------------------------")
245 self.logger.
info(f
"Running {test.ID} metadata check on {self.format}")
247 file_name = f
"my{self.format}.pool.root"
248 if test.type == WorkflowType.Derivation:
249 file_name = f
"{self.format}.myOutput.pool.root"
251 reference_file = self.reference_file(test, file_name)
252 if reference_file
is None:
253 self.logger.
error(f
"Reference file {file_name} not found")
256 self.logger.
info(f
"Reading the reference file from location {reference_file}")
258 exclusion_list =
" ".
join([
"file_guid",
"file_size",
"/TagInfo/AtlasRelease",
"FileMetaData/productionRelease",
"StreamDAOD_PHYS/eventTypes",
"StreamDAOD_PHYSLITE/eventTypes"])
260 validation_file = test.validation_path / file_name
261 log_file = test.validation_path / f
"meta-diff-{test.ID}.{self.format}.log"
263 comparison_command = f
"meta-diff --ordered -m full -x diff {reference_file} {validation_file} --drop {exclusion_list} --ignoreTrigger > {log_file} 2>&1"
264 output, error = subprocess.Popen([
"/bin/bash",
"-c", comparison_command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
265 output, error = output.decode(
"utf-8"), error.decode(
"utf-8")
268 with log_file.open()
as file:
274 self.logger.
info(
"Passed!\n")
277 if self.setup.disable_release_setup:
278 self.logger.
print(f
"ATLAS-CI-ADD-LABEL: {test.run.value}-{test.type.value}-output-changed")
279 self.logger.
print(
"")
281 self.logger.
error(f
"Your change breaks the frozen tier0 policy in test {test.ID}.")
282 self.logger.
error(
"Please make sure this has been discussed in the correct meeting (RIG or Simulation) meeting and approved by the relevant experts.")
285 if self.setup.disable_release_setup:
286 comparison_command = f
"CopyCIArtifact.sh {validation_file}"
287 output, error = subprocess.Popen([
"/bin/bash",
"-c", comparison_command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
288 output, error = output.decode(
"utf-8"), error.decode(
"utf-8")
290 if error
or not output:
291 self.logger.
error(f
"Tried copying '{validation_file}' to the CI artifacts area but it failed.")
292 self.logger.
error(f
" {error.strip()}")
294 self.logger.
error(output)
296 with log_file.open()
as file:
298 self.logger.
info(f
" {line.strip()}")
299 self.logger.
info(
"-----------------------------------------------------\n")
◆ format
python.Checks.MetadataCheck.format |
◆ logger
python.Test.WorkflowCheck.logger |
|
inherited |
◆ setup
python.Test.WorkflowCheck.setup |
|
inherited |
The documentation for this class was generated from the following file: