diff --git a/SAS/TMSS/backend/services/lobster/lib/deploy_configuration.py b/SAS/TMSS/backend/services/lobster/lib/deploy_configuration.py new file mode 100644 index 0000000000000000000000000000000000000000..0005a901cf9113095038ff9aa172344c1de2d8ca --- /dev/null +++ b/SAS/TMSS/backend/services/lobster/lib/deploy_configuration.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2023 +# ASTRON (Netherlands Institute for Radio Astronomy) +# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +# +# This file is part of the LOFAR software suite. +# The LOFAR software suite is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# The LOFAR software suite is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. +# +# $Id$ + + +def station_to_host(station: str) -> str: + """Convert name of station into connectable URL for connecting to PyTango""" + return f"{station}c.control.lofar" + +# Node from which observations are started on COBALT +COBALT_HEADNODE = "cbm299.control.lofar" + +# Storage location for parsets on COBALT_HEADNODE +COBALT_PARSET_DIR = "/opt/lofar/var/run" + +# Name pattern for parsets stored on COBALT_HEADNODE +# This naming is consistent with earlier systems (OnlineControl) +COBALT_PARSET_FILENAME_PATTERN = f"CorrProc_%(subtask_id).param" + +# Script to start observations on COBALT_HEADNODE +COBALT_STARTBGL_SCRIPT = "/opt/lofar/bin/startBGL.sh" diff --git a/SAS/TMSS/backend/services/lobster/lib/message_handler.py b/SAS/TMSS/backend/services/lobster/lib/message_handler.py index c129f52113de1e09c79bcb17313e7bb94beaaf78..b00986ad5326de6376a0d635bd35b1ede99509ae 100644 --- a/SAS/TMSS/backend/services/lobster/lib/message_handler.py +++ b/SAS/TMSS/backend/services/lobster/lib/message_handler.py @@ -28,6 +28,13 @@ from lofar.sas.tmss.services.lobster.specification_translation import ( combine_l2specification_multistation ) +from .deploy_configuration import ( + COBALT_HEADNODE, + COBALT_PARSET_DIR, + COBALT_STARTBGL_SCRIPT, + COBALT_PARSET_FILENAME_PATTERN, +) + from copy import copy from time import sleep from datetime import datetime, timedelta @@ -130,15 +137,10 @@ class L2TMSSObservationControlMessageHandler(TMSSEventMessageHandler): # then for a script to kickstart the observation process. COBALT # will then spawn its own processes to prepare and start the observation. - COBALT_HEADNODE = "cbm299.control.lofar" - COBALT_PARSET_DIR = "/opt/lofar/var/run" - COBALT_START_SCRIPT = "/opt/lofar/bin/startBGL.sh" - - # This naming is consistent with earlier systems (OnlineControl) - PARSET_FILENAME= f"CorrProc_{subtask_id}.param" - with TemporaryDirectory(prefix=f"tmp-cobalt-{subtask_id}-") as tmpdir: # write parset to disk so we can scp it + parset_filename = COBALT_PARSET_FILENAME_PATTERN.format(subtask_id=subtask_id) + with open(f"{tmpdir}/{PARSET_FILENAME}", "w") as parset: l2parset = self.tmss_client.get_subtask_parset(subtask_id, retry_count=5) parset.write(l2parset) diff --git a/SAS/TMSS/backend/services/lobster/lib/specification_translation.py b/SAS/TMSS/backend/services/lobster/lib/specification_translation.py index cee681a3b25138f85633cdde8ae95af3e1a79acb..5582d1c5e3aa26072ad15428b64098e8c30f73d5 100644 --- a/SAS/TMSS/backend/services/lobster/lib/specification_translation.py +++ b/SAS/TMSS/backend/services/lobster/lib/specification_translation.py @@ -28,17 +28,13 @@ from typing import List import logging logger = logging.getLogger(__name__) +from .deploy_configuration import station_to_host class MultistationData(TypedDict): stations: List[str] specification: dict -def station_to_host(station: str) -> str: - """Convert name of station into connectable URL for connecting to PyTango""" - return f"{station}c.control.lofar" - - def combine_l2specification_multistation( l2specification: dict ) -> Dict[str, Union[List[str], Dict]]: