Skip to content
Snippets Groups Projects
Commit 99240d98 authored by Jan David Mol's avatar Jan David Mol
Browse files

Move deployment constants to separate source file.

parent 99dfb193
No related branches found
No related tags found
1 merge request!1131L2SS-1444: Also send the observation parset to COBALT when starting an observation
#!/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"
......@@ -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)
......
......@@ -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]]:
......
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