Skip to content
Snippets Groups Projects
Commit d1f428c9 authored by Janet Goldstein's avatar Janet Goldstein Committed by Daniel Lyons
Browse files

WS-507: Corrections per review of MR333

still TODO: finish that test, finish linting
parent 841c7dc7
No related branches found
No related tags found
1 merge request!337ingestion manifest creation for EVLA CAL ingestion only
......@@ -3,7 +3,7 @@
import sys
from pathlib import Path
from ingest_envoy.ingestion_manifest_writer import EvlaCalIngestionManifestWriter
from ingest_envoy.ingestion_manifest import IngestionManifest
from ingest_envoy.utilities import ScienceProductType
......@@ -24,6 +24,4 @@ def main():
# ValueError will be thrown if ingestion_type isn't a known ScienceProductType
ingestion_type = ScienceProductType.from_str(ingestion_type)
writer = EvlaCalIngestionManifestWriter(ingestion_type, source_dir)
writer.write_evla_cal_manifest(locator)
# IngestionManifest(source_dir, ingestion_type, locator).create()
IngestionManifest(source_dir, ingestion_type, locator).create()
"""Build an ingestion manifest file"""
import json
import logging
import re
......@@ -132,7 +130,7 @@ class EvlaCalIngestionManifestWriter:
raise NotImplementedError(f"{self.sp_type}")
@staticmethod
def format_timestamp(start_time: DateTime) -> str:
def format_timestamp(datetime: DateTime) -> str:
"""
Format the current time as follows:
input format:
......@@ -140,25 +138,11 @@ class EvlaCalIngestionManifestWriter:
desired output format as yyyy_MM_dd_'T'HH_mm_ss.SSS:
2021_07_01'T'13_49_17.237
:param start_time: current pendulum timestamp
:param datetime: current pendulum timestamp
:return: timestamp suitable for ingestion manifest filename
"""
time_str = str(start_time)
# change hyphens and colons to underscores
timestamp = time_str.replace("-", "_", len(time_str))
timestamp = timestamp.replace(":", "_", len(timestamp))
# chop off the last bit
timestamp = timestamp.split("+")[0]
# now timestamp ends with ss.###....; round to 3 places
ts_parts = timestamp.split("_")
seconds = float(ts_parts[len(ts_parts) - 1])
rounded = round(seconds, 3)
timestamp = timestamp.replace(str(seconds), str(rounded))
# finally, the T in single quotes
timestamp = timestamp.replace("T", "'T'")
return timestamp
return datetime.format("YYYY_MM_DD'T'hh_mm_ss.SSS")
@staticmethod
def manifest_filename() -> str:
......
......@@ -9,7 +9,6 @@ import pytest
from ingest_envoy.ingestion_manifest import IngestionManifest
from ingest_envoy.utilities import ScienceProductType
# ingest_path import IS used; keep it
from .conftest import populate_fake_ingest_path, WANTED_FILENAMES, UNWANTED
logger = logging.getLogger(IngestionManifest.__name__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment