Skip to content
Snippets Groups Projects

Implemented manifest generation for EB full curation in ingest_envoy

Merged Sam Kagan requested to merge teach-ingest_envoy-full-curation into 2.8.2.1-DEVELOMENT
Files
4
@@ -85,6 +85,7 @@ class IngestionManifest(ManifestComponentIF):
# image manifest has this:
additional_metadata: AbstractTextFile = None,
filename: str = None,
destination_dir: Path | None = None,
):
self.staging_source_dir = staging_source_dir
self.sp_type = sp_type
@@ -94,6 +95,9 @@ class IngestionManifest(ManifestComponentIF):
self.output_group = output_group
self.telescope = telescope
self.filename = filename
self.destination_dir = destination_dir
if destination_dir is None:
self.destination_dir = self.staging_source_dir
# Check if NGAS ingestion should be enabled for all manifests in this environment
self.ngas_ingest = self.get_ngas_flag()
@@ -190,12 +194,12 @@ class IngestionManifest(ManifestComponentIF):
:return:
"""
me_dict = self.to_dict()
if self.reingest is not None and self.reingest.targets is not None:
if self.reingest is not None and not self.reingest.targets:
output_path = Path.cwd() / CURATOR_MANIFEST_FILENAME
elif self.reingest is not None:
output_path = self.staging_source_dir / CURATOR_MANIFEST_FILENAME
output_path = self.destination_dir / CURATOR_MANIFEST_FILENAME
else:
output_path = self.staging_source_dir / MANIFEST_FILENAME
output_path = self.destination_dir / MANIFEST_FILENAME
to_write = json.dumps(me_dict, indent=4)
with open(output_path, "w") as out:
@@ -289,7 +293,7 @@ class IngestionManifestBuilder:
)
self.curation_source = Path(curate[1]) if curate and curate[1] else None
self.target_list = curate[2]
if self.curation_type == CuratorType.FULL and self.target_list not in [None, []]:
if self.curation_type == CuratorType.FULL and not self.target_list:
raise IngestionManifestException(
f"Expected targets=None for full curation, got targets={self.target_list}"
)
@@ -299,14 +303,12 @@ class IngestionManifestBuilder:
self.locator = locator
# directory to put the manifest in
self.manifest_destination_dir = self.staging_source_dir
if not self.manifest_destination_dir:
self.manifest_destination_dir = self.curation_source
if not self.manifest_destination_dir:
self.manifest_destination_dir = manifest_destination_dir
self.manifest_destination_dir = manifest_destination_dir
if self.manifest_destination_dir is None:
self.manifest_destination_dir = self.staging_source_dir
if self.manifest_destination_dir is None:
raise IngestionManifestException(
f"IngestionManifestBuilder: Expected a directory to house the manifest, found instead staging_source_dir={self.staging_source_dir}, curation_source={self.curation_source}, manifest_dir={self.manifest_destination_dir}"
f"IngestionManifestBuilder: Expected a directory to house the manifest, found instead staging_source_dir={self.staging_source_dir}, manifest_destination_dir={self.manifest_destination_dir}"
)
if staging_source_dir is not None:
@@ -350,6 +352,7 @@ class IngestionManifestBuilder:
reingest_group=self._build_reingest_group(),
input_group=None,
output_group=None,
destination_dir=self.manifest_destination_dir,
)
manifest_file = manifest.write()
@@ -366,6 +369,7 @@ class IngestionManifestBuilder:
reingest_group=None,
input_group=self._build_input_group(),
output_group=self._build_evla_cal_output_group(),
destination_dir=self.manifest_destination_dir,
)
# We can't create the ingestion artifacts tar quite yet,
@@ -400,6 +404,7 @@ class IngestionManifestBuilder:
input_group=InputGroup([]),
output_group=self._build_observation_output_group(),
filename=self.filename,
destination_dir=self.manifest_destination_dir,
)
if not manifest.output_group.ancillary_products:
@@ -442,6 +447,7 @@ class IngestionManifestBuilder:
reingest_group=None,
input_group=self._build_input_group(),
output_group=self._build_imaging_output_group(),
destination_dir=self.manifest_destination_dir,
)
artifacts_ap = self._build_artifacts_product()
Loading