From 16b298c3bd47b9f7f04a6ee9ceabc92b278c0569 Mon Sep 17 00:00:00 2001 From: Daniel Sotirhos Date: Thu, 12 Sep 2024 15:57:51 -0700 Subject: [PATCH] Fix: Invalid columns in compact manifest for AnVIL (#6110) --- src/azul/plugins/metadata/anvil/__init__.py | 7 ++++++- test/service/test_manifest.py | 17 ++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/azul/plugins/metadata/anvil/__init__.py b/src/azul/plugins/metadata/anvil/__init__.py index b688f8726..5c09fab37 100644 --- a/src/azul/plugins/metadata/anvil/__init__.py +++ b/src/azul/plugins/metadata/anvil/__init__.py @@ -282,8 +282,13 @@ def manifest_config(self) -> ManifestConfig: # the desired manifest column name, or None to omit the column from the # manifest. custom_field_names = { + ('bundles', 'uuid'): 'files.bundle_uuid', + ('bundles', 'version'): 'files.bundle_version', + ('contents', 'activities', 'activity_table'): None, ('contents', 'files', 'uuid'): None, ('contents', 'files', 'version'): None, + ('sources', 'id'): 'sources.source_id', + ('sources', 'spec'): 'sources.source_spec', } def recurse(mapping: MetadataPlugin._FieldMapping, path: FieldPath): @@ -305,7 +310,7 @@ def recurse(mapping: MetadataPlugin._FieldMapping, path: FieldPath): # The file URL is synthesized from the `uuid` and `version` fields. # Above, we already configured these two fields to be omitted from the # manifest since they are not informative to the user. - result[('contents', 'files')]['file_url'] = 'files.file_url' + result[('contents', 'files')]['file_url'] = 'files.azul_file_url' return result def verbatim_pfb_schema(self, diff --git a/test/service/test_manifest.py b/test/service/test_manifest.py index 4513bbbe7..21be1b355 100644 --- a/test/service/test_manifest.py +++ b/test/service/test_manifest.py @@ -1705,29 +1705,30 @@ def bundles(cls) -> list[SourcedBundleFQID]: ] def test_compact_manifest(self): + self.maxDiff = None response = self._get_manifest(ManifestFormat.compact, filters={}) self.assertEqual(200, response.status_code) expected = [ ( - 'bundle_uuid', + 'files.bundle_uuid', '6b0f6c0f-5d80-a242-accb-840921351cd5', '826dea02-e274-affe-aabc-eb3db63ad068', '826dea02-e274-affe-aabc-eb3db63ad068' ), ( - 'bundle_version', + 'files.bundle_version', '2022-06-01T00:00:00.000000Z', '2022-06-01T00:00:00.000000Z', '2022-06-01T00:00:00.000000Z' ), ( - 'source_id', + 'sources.source_id', '6c87f0e1-509d-46a4-b845-7584df39263b', '6c87f0e1-509d-46a4-b845-7584df39263b', '6c87f0e1-509d-46a4-b845-7584df39263b' ), ( - 'source_spec', + 'sources.source_spec', 'tdr:bigquery:gcp:test_anvil_project:anvil_snapshot:/2', 'tdr:bigquery:gcp:test_anvil_project:anvil_snapshot:/2', 'tdr:bigquery:gcp:test_anvil_project:anvil_snapshot:/2' @@ -1966,12 +1967,6 @@ def test_compact_manifest(self): '18b3be87-e26b-4376-0d8d-c1e370e90e07', 'a60c5138-3749-f7cb-8714-52d389ad5231' ), - ( - 'activities.activity_table', - '', - 'sequencingactivity', - 'sequencingactivity' - ), ( 'activities.activity_type', '', @@ -2075,7 +2070,7 @@ def test_compact_manifest(self): self._drs_uri('v1_6c87f0e1-509d-46a4-b845-7584df39263b_8b722e88-8103-49c1-b351-e64fa7c6ab37') ), ( - 'files.file_url', + 'files.azul_file_url', self._file_url('6b0f6c0f-5d80-4242-accb-840921351cd5', self.version), self._file_url('15b76f9c-6b46-433f-851d-34e89f1b9ba6', self.version), self._file_url('3b17377b-16b1-431c-9967-e5d01fc5923f', self.version)