Skip to content
Snippets Groups Projects
Commit ffc6b173 authored by Charlotte Hausman's avatar Charlotte Hausman
Browse files

fixing aux_image_metadata.json transfer to staging

parent 93c04a51
No related branches found
No related tags found
1 merge request!400fixing aux_image_metadata.json missing from staging area
Pipeline #2415 failed
This commit is part of merge request !400. Comments created here will be created in the context of that merge request.
import glob
import os
import pathlib
import shutil
import subprocess
import sys
import logging
import json
from ingest_envoy.schema import AbstractTextFile
......@@ -17,6 +12,9 @@ class ImageCollector:
self.logger = logging.getLogger("ingest_envoy")
self.parameters = parameters
self.spl = parameters["spl"]
self.staging_source_dir = (
self.parameters["staging_area"] + "/" + self.parameters["workflowDir"]
)
def collect_image_metadata(self) -> AbstractTextFile:
file = open("./aux_image_metadata.json", "r")
......@@ -34,6 +32,13 @@ class ImageCollector:
stdout=sys.stdout,
stderr=sys.stderr,
)
self.aux_file_to_staging()
def aux_file_to_staging(self):
shutil.copy2(
"./aux_image_metadata.json",
self.staging_source_dir,
)
def create_artifacts_name(self):
name = "pipeline_artifacts_"
......
......@@ -30,11 +30,17 @@ class TestImageCollector:
assert mock_open.call_count == 1
assert isinstance(aux, AbstractTextFile)
@patch("shutil.copy2")
@patch("subprocess.run")
def test_collect_image_products(self, mock_run):
def test_collect_image_products(self, mock_run, mock_copy):
image_collector.collect_image_products()
assert mock_run.call_count == 1
@patch("shutil.copy2")
def test_aux_file_to_staging(self, mock_copy):
image_collector.aux_file_to_staging()
assert mock_copy.call_count == 1
def test_create_artifacts_name(self):
expected_name = "pipeline_artifacts_" + parameters["processingStart"]
......
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