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

refactor aat-wrest for sanity

parent 99f1619c
No related branches found
No related tags found
1 merge request!345refactor aat-wrest for sanity
Pipeline #2196 passed with warnings
""" """
Extracts workflow relevant metadata from the NRAO archive based on Science Product Locator. Extracts workflow relevant metadata from the NRAO archive based on Science Product Locator.
""" """
import argparse
import json import json
import logging import logging
import sys
import pendulum import pendulum
from typing import List from typing import List
from aat_wrest.observation_wrester import ObservationWrester
from aat_wrest.utilities import PENDULUM_FORMAT, TIME_ZONE, MDDBConnector from aat_wrest.utilities import PENDULUM_FORMAT, TIME_ZONE, MDDBConnector
logger = logging.getLogger("aat_wrest")
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler(sys.stdout))
class WrestWorkflowMetadata: class WrestWorkflowMetadata:
""" """
...@@ -26,19 +19,12 @@ class WrestWorkflowMetadata: ...@@ -26,19 +19,12 @@ class WrestWorkflowMetadata:
self, self,
connection: MDDBConnector, connection: MDDBConnector,
spl: List[str] = None, spl: List[str] = None,
fileset_id: str = None,
sdm_id: str = None, sdm_id: str = None,
): ):
self.logger = logging.getLogger("aat_wrest") self.logger = logging.getLogger("aat_wrest")
self.conn = connection self.conn = connection
if fileset_id is not None: self.sdm_id = sdm_id
self.fileset_id = fileset_id self.spl = spl
if sdm_id is not None:
self.sdm_id = sdm_id
if not spl and fileset_id:
self.spl = self.wrest_obs_metadata_from_fileset_id(fileset_id)["spl"]
else:
self.spl = spl
def wrest_standard_cal_info(self) -> json: def wrest_standard_cal_info(self) -> json:
""" """
...@@ -89,8 +75,8 @@ class WrestWorkflowMetadata: ...@@ -89,8 +75,8 @@ class WrestWorkflowMetadata:
def wrest_standard_image_info(self) -> json: def wrest_standard_image_info(self) -> json:
""" """
Given an execution block science product locator, returns the required metadata to run Given an execution block SDM ID, returns the required metadata to run
the standard calibration workflow the standard imaging workflow
:return: :return:
""" """
...@@ -140,8 +126,6 @@ class WrestWorkflowMetadata: ...@@ -140,8 +126,6 @@ class WrestWorkflowMetadata:
the required metadata to run the restore CMS workflow the required metadata to run the restore CMS workflow
:return: :return:
""" """
print(self.spl)
eb_sql = f""" eb_sql = f"""
SELECT ngas_fileset_id as filesetId, SELECT ngas_fileset_id as filesetId,
e.project_code as projectCode, e.project_code as projectCode,
...@@ -190,94 +174,3 @@ class WrestWorkflowMetadata: ...@@ -190,94 +174,3 @@ class WrestWorkflowMetadata:
finally: finally:
self.conn.close() self.conn.close()
return make_json return make_json
def wrest_obs_metadata_from_fileset_id(self, fileset_id: str) -> str:
"""
Given a fileset_id, query the Metadata DB and return the corresponding science_product_locator
:param fileset_id:
:return science_product_locator:
"""
metadata = {
"spl": None,
"bands": None,
"array_config": None,
"obs_start_time": None,
"obs_end_time": None,
}
sql = f"""
SELECT science_product_locator, band_code, configuration, starttime, endtime
FROM execution_blocks
WHERE ngas_fileset_id = %(fileset_id)s
"""
with self.conn.cursor() as cursor:
cursor.execute(sql, {"fileset_id": fileset_id})
data = cursor.fetchall()
metadata["spl"] = data[0][0]
metadata["bands"] = data[0][1]
metadata["array_config"] = data[0][2]
metadata["obs_start_time"] = data[0][3]
metadata["obs_end_time"] = data[0][4]
return metadata
def parser() -> argparse.ArgumentParser:
arg_parser = argparse.ArgumentParser(
description="Workspaces-to-Archive Metadata Exchange",
formatter_class=argparse.RawTextHelpFormatter,
)
arg_parser.add_argument(
"-sc",
"--stdcals",
nargs=1,
action="store",
required=False,
help="Find workflow metadata for standard calibrations with provided product locator",
)
arg_parser.add_argument(
"-si",
"--stdimg",
nargs=1,
action="store",
required=False,
help="Find workflow metadata for standard CMS imaging with provided SDM id",
)
arg_parser.add_argument(
"-r",
"--restore",
nargs="+",
default=[],
required=False,
help="Find workflow metadata for Restores with provided EB product locator and Cal product locator",
)
arg_parser.add_argument(
"-obs",
"--observation",
nargs=1,
action="store",
required=False,
help="Find display metadata for observations by product locator",
)
return arg_parser
def determine_wrester(connection: MDDBConnector, args: argparse.Namespace):
if args.stdcals:
data = WrestWorkflowMetadata(connection, spl=args.stdcals[0]).wrest_standard_cal_info()
if args.stdimg:
data = WrestWorkflowMetadata(connection, sdm_id=args.stdimg[0]).wrest_standard_image_info()
if args.restore:
print(args)
data = WrestWorkflowMetadata(connection, spl=args.restore).wrest_restore_info()
if args.observation:
data = ObservationWrester(connection, spl=args.observation[0]).wrest_observation_info()
print(data)
def main():
args = parser().parse_args()
connection = MDDBConnector()
determine_wrester(connection, args)
...@@ -11,17 +11,60 @@ import pendulum ...@@ -11,17 +11,60 @@ import pendulum
from aat_wrest.utilities import MDDBConnector, TIME_ZONE, format_interval from aat_wrest.utilities import MDDBConnector, TIME_ZONE, format_interval
class ObservationWrester: class WrestObservationMetadata:
""" """
Class for extracting observation metadata Class for extracting observation metadata
""" """
def __init__(self, connection: MDDBConnector, spl: str): def __init__(self, connection: MDDBConnector, sdm_id: str):
self.logger = logging.getLogger("aat_wrest") self.logger = logging.getLogger("aat_wrest")
self.conn = connection self.conn = connection
self.spl = spl self.sdm_id = sdm_id
def wrest_observation_info(self) -> json: def wrest_observation_info(self) -> json:
"""
Given a sdm_id, query the Metadata DB for observation data related to an ingestion-complete event
:param sdm_id:
:return science_product_locator:
"""
metadata = {}
sql = f"""
SELECT science_product_locator,
band_code,
configuration,
starttime,
endtime
FROM execution_blocks
WHERE ngas_fileset_id = %(sdm_id)s
"""
try:
cursor = self.conn.cursor()
cursor.execute(sql, {"sdm_id": self.sdm_id})
data = cursor.fetchall()
if data:
metadata = json.dumps(
{
"spl": data[0][0],
"bands": data[0][1],
"array_config": data[0][2],
"obs_start_time": data[0][3],
"obs_end_time": data[0][4],
}
)
else:
self.logger.error(
f"ERROR: aat-wrest query returned no results!"
f" The database appears to be missing information for SDM id {self.sdm_id}"
)
finally:
self.conn.close()
return metadata
#
# currently unused. Was intended for analyst list display of waiting capability requests/executions
#
def wrest_observation_time_info(self) -> json:
""" """
Given a product locator, reports the project code, observation length, Given a product locator, reports the project code, observation length,
and time in queue for an incomplete observation. and time in queue for an incomplete observation.
......
import argparse
import logging
import sys
from aat_wrest.observation_wrester import WrestObservationMetadata
from aat_wrest.metadata_wrester import WrestWorkflowMetadata
from aat_wrest.utilities import MDDBConnector
"""
AAT Wrest extract information from the NRAO Archive metadata database
"""
logger = logging.getLogger("aat_wrest")
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler(sys.stdout))
def parser() -> argparse.ArgumentParser:
arg_parser = argparse.ArgumentParser(
description="Workspaces-to-Archive Metadata Exchange",
formatter_class=argparse.RawTextHelpFormatter,
)
arg_parser.add_argument(
"-sc",
"--stdcals",
nargs=1,
action="store",
required=False,
help="Find workflow metadata for standard calibrations with provided product locator",
)
arg_parser.add_argument(
"-si",
"--stdimg",
nargs=1,
action="store",
required=False,
help="Find workflow metadata for standard CMS imaging with provided SDM id",
)
arg_parser.add_argument(
"-r",
"--restore",
nargs="+",
default=[],
required=False,
help="Find workflow metadata for Restores with provided EB product locator and Cal product locator",
)
arg_parser.add_argument(
"-obs",
"--observation",
nargs=1,
action="store",
required=False,
help="Find display metadata for observations by SDM id",
)
return arg_parser
def determine_wrester(connection: MDDBConnector, args: argparse.Namespace):
if args.stdcals:
data = WrestWorkflowMetadata(connection, spl=args.stdcals[0]).wrest_standard_cal_info()
elif args.stdimg:
data = WrestWorkflowMetadata(connection, sdm_id=args.stdimg[0]).wrest_standard_image_info()
elif args.restore:
print(args)
data = WrestWorkflowMetadata(connection, spl=args.restore).wrest_restore_info()
elif args.observation:
data = WrestObservationMetadata(
connection, sdm_id=args.observation[0]
).wrest_observation_info()
else:
data = None
print(data)
def main():
args = parser().parse_args()
connection = MDDBConnector()
determine_wrester(connection, args)
...@@ -23,5 +23,5 @@ setup( ...@@ -23,5 +23,5 @@ setup(
keywords=[], keywords=[],
packages=["aat_wrest"], packages=["aat_wrest"],
classifiers=["Programming Language :: Python :: 3.8"], classifiers=["Programming Language :: Python :: 3.8"],
entry_points={"console_scripts": ["aat_wrest = aat_wrest.metadata_wrester:main"]}, entry_points={"console_scripts": ["aat_wrest = aat_wrest.wrest:main"]},
) )
...@@ -43,35 +43,11 @@ def mock_wrester(args: argparse.Namespace) -> WrestWorkflowMetadata: ...@@ -43,35 +43,11 @@ def mock_wrester(args: argparse.Namespace) -> WrestWorkflowMetadata:
return WrestWorkflowMetadata(connection=mock_connect, sdm_id=args.stdimg) return WrestWorkflowMetadata(connection=mock_connect, sdm_id=args.stdimg)
@pytest.fixture
def fake_obs_metadata() -> List[Tuple[str]]:
return [
(
"uid://evla/execblock/8fbfb54b-d141-42fe-b079-609339a69cba",
"Ka",
"D",
"1234567",
"123598898",
)
]
cal_wrester = mock_wrester(args_cal) cal_wrester = mock_wrester(args_cal)
img_wrester = mock_wrester(args_image) img_wrester = mock_wrester(args_image)
class TestAatWrest: class TestAatWrest:
def test_init(self, fake_obs_metadata: List[Tuple[str]]):
fileset_id = "17B-197.sb34663512.eb34806505.58108.78427738426"
with patch("psycopg2.connect") as mock_connect:
mock_connect.cursor.return_value.__enter__.return_value.fetchall.return_value = (
fake_obs_metadata
)
wrester_no_spl = WrestWorkflowMetadata(
connection=mock_connect, spl=None, fileset_id=fileset_id
)
assert wrester_no_spl.spl == "uid://evla/execblock/8fbfb54b-d141-42fe-b079-609339a69cba"
@patch("json.dumps", MagicMock(return_value=result_cal)) @patch("json.dumps", MagicMock(return_value=result_cal))
def test_wrest_standard_cal_info(self): def test_wrest_standard_cal_info(self):
cal_wrester.conn.cursor.return_value.fetchall.return_value = [ cal_wrester.conn.cursor.return_value.fetchall.return_value = [
...@@ -112,19 +88,3 @@ class TestAatWrest: ...@@ -112,19 +88,3 @@ class TestAatWrest:
' "projectCode": "Operations", "title": "", "startTime": 58099.6710792824, ' ' "projectCode": "Operations", "title": "", "startTime": 58099.6710792824, '
'"observer": "VLA Operations", "telescope": "EVLA", "created_at": "2021-06-30T20:18:21"}' '"observer": "VLA Operations", "telescope": "EVLA", "created_at": "2021-06-30T20:18:21"}'
) )
def test_wrest_obs_metadata_from_fileset_id(self, fake_obs_metadata: List[Tuple[str]]):
cal_wrester.conn.cursor.return_value.__enter__.return_value.fetchall.return_value = (
fake_obs_metadata
)
metadata = cal_wrester.wrest_obs_metadata_from_fileset_id(
"17B-197.sb34663512.eb34806505.58108.78427738426"
)
assert metadata == {
"spl": "uid://evla/execblock/8fbfb54b-d141-42fe-b079-609339a69cba",
"bands": "Ka",
"array_config": "D",
"obs_start_time": "1234567",
"obs_end_time": "123598898",
}
"""
Tests for aat_wrest.observation_wrester
"""
import argparse
from enum import Enum
from unittest.mock import patch, MagicMock
# pylint: disable=E0401, E0402
import json
import pytest
from aat_wrest.observation_wrester import WrestObservationMetadata
class Keys(Enum):
"""The things we're reporting"""
PROJECT = "projectCode"
OBS_TIME = "timeObserved"
QUEUE_TIME = "timeInQueue"
PROJECT = Keys.PROJECT.value
OBS_TIME = Keys.OBS_TIME.value
QUEUE_TIME = Keys.QUEUE_TIME.value
_17A_109_SPL = "uid://evla/execblock/5c71ade0-d035-4fd5-a36f-0389e34db0e5"
_17A_109_ARGS = argparse.Namespace(spl=_17A_109_SPL)
_17A_109_EXPECTED = {
PROJECT: "17A-109",
OBS_TIME: "0 days, 0 hours, 4 minutes, 34 seconds",
QUEUE_TIME: "1125 days, 11 hours, 43 minutes, 58 seconds",
}
args = argparse.Namespace(observation="17B-197.sb34663512.eb34806505.58108.78427738426")
result_obs = (
'{"spl": "uid://evla/execblock/8fbfb54b-d141-42fe-b079-609339a69cba", '
'"bands": "Ka", '
'"array_config": "D", '
'"obs_start_time": "1234567", '
'"obs_end_time": "123598898" }'
)
def mock_wrester(args: argparse.Namespace) -> WrestObservationMetadata:
"""
Pretend to get the information from the MDDB.
:param args:
:return:
"""
with patch("psycopg2.connect") as conn:
return WrestObservationMetadata(conn, args.observation)
wrester = mock_wrester(args)
class TestWrestObservationInfo:
@patch("json.dumps", MagicMock(return_value=result_obs))
def test_wrest_observation_info(self):
wrester.conn.cursor.return_value.fetchall.return_value = [
"uid://evla/execblock/8fbfb54b-d141-42fe-b079-609339a69cba",
"Ka",
"D",
"1234567",
"123598898",
]
assert args.observation == "17B-197.sb34663512.eb34806505.58108.78427738426"
metadata = wrester.wrest_observation_info()
assert (
metadata == '{"spl": "uid://evla/execblock/8fbfb54b-d141-42fe-b079-609339a69cba", '
'"bands": "Ka", '
'"array_config": "D", '
'"obs_start_time": "1234567", '
'"obs_end_time": "123598898" }'
)
@pytest.mark.skip("Dates are broken. Method superseded by wrest_observation_info")
@patch("json.dumps", MagicMock(return_value=_17A_109_EXPECTED))
def test_gets_expected_observation_info(self):
"""
Does ObservationWrester wrest the expected data from the MDDB?
:return:
"""
wrester = mock_wrester(_17A_109_ARGS)
assert wrester.spl == _17A_109_SPL
actual = wrester.wrest_observation_time_info()
assert actual == _17A_109_EXPECTED
@pytest.mark.skip("... Dates are broken... Method superseded by wrest_observation_info")
def test_handles_evla_exec_block(self):
"""
Confirm we get what we expect when observing time is minimal.
:return:
"""
spl = "uid://evla/execblock/91c685b6-4527-44b1-9f91-3904e1125817"
args = argparse.Namespace(spl=spl)
expected = {
PROJECT: "19A-440",
OBS_TIME: "0 days, 0 hours, 0 minutes, 4 seconds",
QUEUE_TIME: "627 days, 22 hours, 43 minutes, 6 seconds",
}
with patch("json.dumps", MagicMock(return_value=expected)):
wrester = mock_wrester(args)
actual = wrester.wrest_observation_time_info()
assert actual[PROJECT] == expected[PROJECT]
obs_parts = actual[OBS_TIME].split(", ")
seconds_part = obs_parts[3].split(" ")
assert int(seconds_part[0]) == 4
""" WS-351: As a DA I want to see a list of capability requests per capability / WS-368 """
import argparse
import json
import logging
import os
import sys
from enum import Enum
from unittest.mock import patch, MagicMock
# pylint: disable=E0401, E0402
import pytest
from aat_wrest.observation_wrester import ObservationWrester
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler(sys.stdout))
class Keys(Enum):
"""The things we're reporting"""
PROJECT = "projectCode"
OBS_TIME = "timeObserved"
QUEUE_TIME = "timeInQueue"
PROJECT = Keys.PROJECT.value
OBS_TIME = Keys.OBS_TIME.value
QUEUE_TIME = Keys.QUEUE_TIME.value
_17A_109_SPL = "uid://evla/execblock/5c71ade0-d035-4fd5-a36f-0389e34db0e5"
_17A_109_ARGS = argparse.Namespace(spl=_17A_109_SPL)
_17A_109_EXPECTED = {
PROJECT: "17A-109",
OBS_TIME: "0 days, 0 hours, 4 minutes, 34 seconds",
QUEUE_TIME: "1125 days, 11 hours, 43 minutes, 58 seconds",
}
def mock_wrester(args: argparse.Namespace) -> ObservationWrester:
"""
Pretend to get the information from the MDDB.
:param args:
:return:
"""
with patch("psycopg2.connect") as conn:
return ObservationWrester(conn, args.spl)
@pytest.mark.skip("... Dates are broken...")
@patch("json.dumps", MagicMock(return_value=_17A_109_EXPECTED))
def test_gets_expected_observation_info():
"""
Does ObservationWrester wrest the expected data from the MDDB?
:return:
"""
wrester = mock_wrester(_17A_109_ARGS)
assert wrester.spl == _17A_109_SPL
actual = wrester.wrest_observation_info()
assert actual == _17A_109_EXPECTED
@pytest.mark.skip("actually hits the metadata database")
def test_really_pulls_observation_info():
"""
Does ObservationWrester wrest the expected data from the MDDB 4 realz?
We're always going to skip this test, but let's keep it here
for degubbing porpoises.
:return:
"""
wrester = mock_wrester(_17A_109_ARGS)
json_str = ObservationWrester(wrester.conn, _17A_109_SPL).wrest_observation_info()
obsv_dict = json.loads(json_str)
assert obsv_dict[PROJECT] == _17A_109_EXPECTED[PROJECT]
time_obsvd = obsv_dict[OBS_TIME]
assert time_obsvd == "0 days, 0 hours, 4 minutes, 34 seconds"
time_in_queue = obsv_dict[QUEUE_TIME]
parts = time_in_queue.split(", ")
days_part = parts[0].split(" ")
assert int(days_part[0]) > 1124
@pytest.mark.skip("... Dates are broken...")
def test_handles_evla_exec_block():
"""
Confirm we get what we expect when observing time is minimal.
:return:
"""
spl = "uid://evla/execblock/91c685b6-4527-44b1-9f91-3904e1125817"
args = argparse.Namespace(spl=spl)
expected = {
PROJECT: "19A-440",
OBS_TIME: "0 days, 0 hours, 0 minutes, 4 seconds",
QUEUE_TIME: "627 days, 22 hours, 43 minutes, 6 seconds",
}
with patch("json.dumps", MagicMock(return_value=expected)):
wrester = mock_wrester(args)
actual = wrester.wrest_observation_info()
assert actual[PROJECT] == expected[PROJECT]
obs_parts = actual[OBS_TIME].split(", ")
seconds_part = obs_parts[3].split(" ")
assert int(seconds_part[0]) == 4
@pytest.mark.skip("... VLBA isn't calibratable...")
def test_handles_vlba_observation():
"""
Confirm we get what we expect when observing time is at high end.
:return:
"""
spl = "uid://evla/execblock/9fbb86eb-ba14-42e7-8fd7-5c45aff36725"
expected = {
PROJECT: "BM468",
OBS_TIME: "0 days, 11 hours, 59 minutes, 57 seconds",
QUEUE_TIME: "933 days, 11 hours, 48 minutes, 12 seconds",
}
with patch("json.dumps", MagicMock(return_value=expected)):
wrester = mock_wrester(argparse.Namespace(spl=spl))
actual = wrester.wrest_observation_info()
assert actual[PROJECT] == expected[PROJECT]
obs_parts = actual[OBS_TIME].split(", ")
hours_part = obs_parts[1].split(" ")
assert int(hours_part[0]) == 11
@pytest.mark.skip("... ALMA isn't calibratable...")
def test_handles_alma():
"""
Can we report a pending ALMA observation?
:return:
"""
spl = "uid://alma/execblock/a4154db4-a834-4020-896a-6fd4613bf986"
expected = {
PROJECT: "2019.1.01635.S",
OBS_TIME: "0 days, 1 hours, 57 minutes, 4 seconds",
QUEUE_TIME: "517 days, 2 hours, 5 minutes, 15 seconds",
}
with patch("json.dumps", MagicMock(return_value=expected)):
wrester = mock_wrester(argparse.Namespace(spl=spl))
actual = wrester.wrest_observation_info()
assert actual[PROJECT] == expected[PROJECT]
time_parts = actual[QUEUE_TIME].split(", ")
days_part = time_parts[0].split(" ")
assert int(days_part[0]) >= 517
from typing import Dict from typing import Dict
from unittest.mock import patch from unittest.mock import patch
import json
import pytest import pytest
from workspaces.products.services.archive_service import ArchiveService from workspaces.products.services.archive_service import ArchiveService
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def fake_metadata() -> Dict[str, str]: def fake_metadata() -> json:
return { return {
"spl": "uid://evla/execblock/8fbfb54b-d141-42fe-b079-609339a69cba", "spl": "uid://evla/execblock/8fbfb54b-d141-42fe-b079-609339a69cba",
"bands": "Ka", "bands": "Ka",
...@@ -46,7 +47,7 @@ class TestArchiveService: ...@@ -46,7 +47,7 @@ class TestArchiveService:
expected_spl = "uid://evla/execblock/8fbfb54b-d141-42fe-b079-609339a69cba" expected_spl = "uid://evla/execblock/8fbfb54b-d141-42fe-b079-609339a69cba"
with patch( with patch(
"workspaces.products.services.archive_service.WrestWorkflowMetadata.wrest_obs_metadata_from_fileset_id", "workspaces.products.services.archive_service.WrestObservationMetadata.wrest_observation_info",
) as mock_wrest_obs_metadata: ) as mock_wrest_obs_metadata:
mock_wrest_obs_metadata.return_value = fake_metadata mock_wrest_obs_metadata.return_value = fake_metadata
with patch("workspaces.products.services.archive_service.Router"): with patch("workspaces.products.services.archive_service.Router"):
......
...@@ -2,7 +2,8 @@ import logging ...@@ -2,7 +2,8 @@ import logging
from typing import Dict from typing import Dict
import requests import requests
from aat_wrest.metadata_wrester import WrestWorkflowMetadata from aat_wrest.observation_wrester import WrestObservationMetadata
from aat_wrest.utilities import MDDBConnector from aat_wrest.utilities import MDDBConnector
from messaging.router import Router, on_message from messaging.router import Router, on_message
from pycapo import CapoConfig from pycapo import CapoConfig
...@@ -36,12 +37,12 @@ class ArchiveService(ArchiveServiceIF): ...@@ -36,12 +37,12 @@ class ArchiveService(ArchiveServiceIF):
logger.info(f"ingestion-complete event: {logdata}") logger.info(f"ingestion-complete event: {logdata}")
execblock_id = logdata["execblock_id"] execblock_id = logdata["execblock_id"]
fileset_id = logdata["fileset_id"] sdm_id = logdata["fileset_id"]
project_code = logdata["project_code"] project_code = logdata["project_code"]
wrester = WrestWorkflowMetadata(MDDBConnector(), spl=None, fileset_id=fileset_id) wrester = WrestObservationMetadata(MDDBConnector(), sdm_id=sdm_id)
metadata = wrester.wrest_obs_metadata_from_fileset_id(fileset_id) metadata = wrester.wrest_observation_info()
metadata["fileset_id"] = fileset_id metadata["sdm_id"] = sdm_id
spl = metadata["spl"] spl = metadata["spl"]
del metadata["spl"] del metadata["spl"]
...@@ -53,7 +54,7 @@ class ArchiveService(ArchiveServiceIF): ...@@ -53,7 +54,7 @@ class ArchiveService(ArchiveServiceIF):
type(response), type(response),
response.content, response.content,
) )
return spl, execblock_id, fileset_id, project_code return spl, execblock_id, sdm_id, project_code
@staticmethod @staticmethod
def _create_std_calibration_request(spl: str, metadata: Dict[str, str]) -> Response: def _create_std_calibration_request(spl: str, metadata: Dict[str, str]) -> Response:
...@@ -62,7 +63,7 @@ class ArchiveService(ArchiveServiceIF): ...@@ -62,7 +63,7 @@ class ArchiveService(ArchiveServiceIF):
:param spl: Science product locator of observation :param spl: Science product locator of observation
:param metadata: Dict with the following information inside: :param metadata: Dict with the following information inside:
- fileset_id: File Set ID - sdm_id: SDM ID (sometimes called fileset id)
- bands: Radio bands for observation - bands: Radio bands for observation
- array_config: Configuration of array telescopes - array_config: Configuration of array telescopes
- obs_start_time: Start time of observation - obs_start_time: Start time of observation
......
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