diff --git a/bin/start-ds.sh b/bin/start-ds.sh index e7fab7e9331b4512f9caf13bb9096146605fd4d9..7b601c4c8f5e24ac56755ad08a1203a6cbba62d2 100755 --- a/bin/start-ds.sh +++ b/bin/start-ds.sh @@ -25,7 +25,7 @@ else mkdir -p /tmp/tangostationcontrol python3 setup.py build --build-base /tmp/tangostationcontrol egg_info --egg-base /tmp/tangostationcontrol bdist_wheel --dist-dir /tmp/tangostationcontrol || exit 1 # shellcheck disable=SC2012 - sudo pip install "$(ls -Art /tmp/tangostationcontrol/*.whl | tail -n 1)" + sudo pip install --force-reinstall "$(ls -Art /tmp/tangostationcontrol/*.whl | tail -n 1)" fi /usr/local/bin/wait-for-it.sh "$TANGO_HOST" --timeout=30 --strict -- "$@" diff --git a/docker-compose/device-apsct.yml b/docker-compose/device-apsct.yml index 3d5a2e034de34f77d80b5a28305dc5617874f48f..bab24bd77499c6b6aea5cc27cb98588227c7c046 100644 --- a/docker-compose/device-apsct.yml +++ b/docker-compose/device-apsct.yml @@ -32,13 +32,10 @@ services: - ..:/opt/lofar/tango:rw environment: - TANGO_HOST=${TANGO_HOST} + working_dir: /opt/lofar/tango entrypoint: - - /usr/local/bin/wait-for-it.sh - - ${TANGO_HOST} - - --timeout=30 - - --strict - - -- + - bin/start-ds.sh # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # can't know about our Docker port forwarding - - python3 -u /opt/lofar/tango/devices/devices/apsct.py STAT -v -ORBendPoint giop:tcp:0:5709 -ORBendPointPublish giop:tcp:${HOSTNAME}:5709 + - l2ss-apspu Apsct STAT -v -v -ORBendPoint giop:tcp:0:5709 -ORBendPointPublish giop:tcp:${HOSTNAME}:5709 restart: on-failure diff --git a/docker-compose/device-apspu.yml b/docker-compose/device-apspu.yml index 04b89ac4a19efddf56c2b9a72ef05d05f54159db..b694b09518215e293d19e1ff551f4f608e6f818d 100644 --- a/docker-compose/device-apspu.yml +++ b/docker-compose/device-apspu.yml @@ -32,13 +32,10 @@ services: - ..:/opt/lofar/tango:rw environment: - TANGO_HOST=${TANGO_HOST} + working_dir: /opt/lofar/tango entrypoint: - - /usr/local/bin/wait-for-it.sh - - ${TANGO_HOST} - - --timeout=30 - - --strict - - -- + - bin/start-ds.sh # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # can't know about our Docker port forwarding - - python3 -u /opt/lofar/tango/devices/devices/apspu.py STAT -v -ORBendPoint giop:tcp:0:5710 -ORBendPointPublish giop:tcp:${HOSTNAME}:5710 + - l2ss-apspu Apspu STAT -v -ORBendPoint giop:tcp:0:5710 -ORBendPointPublish giop:tcp:${HOSTNAME}:5710 restart: on-failure diff --git a/docker-compose/device-boot.yml b/docker-compose/device-boot.yml index 9a4a13ff7494ec0e85af3581ba33a73477c86cf8..3db111410fafde9901fd8f91cb40a1c3560e4242 100644 --- a/docker-compose/device-boot.yml +++ b/docker-compose/device-boot.yml @@ -31,6 +31,7 @@ services: - ..:/opt/lofar/tango:rw environment: - TANGO_HOST=${TANGO_HOST} + working_dir: /opt/lofar/tango entrypoint: - bin/start-ds.sh # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA diff --git a/tangostationcontrol/setup.cfg b/tangostationcontrol/setup.cfg index daee0edbff26ee8f44613d75dd8a6bcd411906e0..e6101c890893c961e1eff27ce3d3ab4e019ea312 100644 --- a/tangostationcontrol/setup.cfg +++ b/tangostationcontrol/setup.cfg @@ -34,6 +34,8 @@ where=./ [options.entry_points] console_scripts = + l2ss-apsct = tangostationcontrol.devices.apsct:main + l2ss-apspu = tangostationcontrol.devices.apspu:main l2ss-boot = tangostationcontrol.devices.boot:main l2ss-docker-device = tangostationcontrol.devices.docker_device:main l2ss-observation = tangostationcontrol.devices.observation:main @@ -41,10 +43,10 @@ console_scripts = l2ss-receiver = tangostationcontrol.devices.recv:main l2ss-sdp = tangostationcontrol.devices.sdp.sdp:main l2ss-sst = tangostationcontrol.devices.sdp.sst:main - l2ss-unb2 = tangostationcontrol.devices.unb2:main - l2ss-xst = tangostationcontrol.devices.sdp.xst:main l2ss-statistics-reader = tangostationcontrol.statistics_writer.statistics_reader:main l2ss-statistics-writer = tangostationcontrol.statistics_writer.statistics_writer:main + l2ss-unb2 = tangostationcontrol.devices.unb2:main + l2ss-xst = tangostationcontrol.devices.sdp.xst:main # The following entry points should eventually be removed / replaced l2ss-cold-start = tangostationcontrol.toolkit.lts_cold_start:main diff --git a/tangostationcontrol/tangostationcontrol/devices/apsct.py b/tangostationcontrol/tangostationcontrol/devices/apsct.py index b32c5d0c8b1637a99f7e429c44083246491fe332..7c1872e73c8fcdffa6ca9e07a7b3cd059bde044f 100644 --- a/tangostationcontrol/tangostationcontrol/devices/apsct.py +++ b/tangostationcontrol/tangostationcontrol/devices/apsct.py @@ -11,31 +11,25 @@ """ -# TODO(Corne): Remove sys.path.append hack once packaging is in place! -import os, sys -currentdir = os.path.dirname(os.path.realpath(__file__)) -parentdir = os.path.dirname(currentdir) -sys.path.append(parentdir) - # PyTango imports from tango import DebugIt from tango.server import run, command -from tango.server import device_property, attribute from tango import AttrWriteType import numpy # Additional import -from device_decorators import * - -from clients.attribute_wrapper import attribute_wrapper -from devices.opcua_device import opcua_device -from common.lofar_logging import device_logging_to_python, log_exceptions +from tangostationcontrol.clients.attribute_wrapper import attribute_wrapper +from tangostationcontrol.common.entrypoint import entry +from tangostationcontrol.common.lofar_logging import device_logging_to_python, log_exceptions +from tangostationcontrol.devices.device_decorators import * +from tangostationcontrol.devices.opcua_device import opcua_device import logging logger = logging.getLogger() __all__ = ["APSCT", "main"] + @device_logging_to_python() class APSCT(opcua_device): # ----------------- @@ -120,17 +114,10 @@ class APSCT(opcua_device): """ self.opcua_connection.call_method(["APSCT_on"]) + # ---------- # Run server # ---------- -def main(args=None, **kwargs): - """Main function of the APSCT module.""" - - from common.lofar_logging import configure_logger - configure_logger() - - return run((APSCT,), args=args, **kwargs) - - -if __name__ == '__main__': - main() +def main(**kwargs): + """Main function of the ObservationControl module.""" + return entry(APSCT, **kwargs) diff --git a/tangostationcontrol/tangostationcontrol/devices/apspu.py b/tangostationcontrol/tangostationcontrol/devices/apspu.py index 3daab9c071a73b75a4d28def984d4794d4aa7aef..88a677fcb1cd743e1e59f8fe3aecbbb2a0992cba 100644 --- a/tangostationcontrol/tangostationcontrol/devices/apspu.py +++ b/tangostationcontrol/tangostationcontrol/devices/apspu.py @@ -11,28 +11,20 @@ """ -# TODO(Corne): Remove sys.path.append hack once packaging is in place! -import os, sys -currentdir = os.path.dirname(os.path.realpath(__file__)) -parentdir = os.path.dirname(currentdir) -sys.path.append(parentdir) - # PyTango imports -from tango import DebugIt -from tango.server import run, command -from tango.server import device_property, attribute from tango import AttrWriteType import numpy # Additional import -from device_decorators import * - -from clients.attribute_wrapper import attribute_wrapper -from devices.opcua_device import opcua_device -from common.lofar_logging import device_logging_to_python, log_exceptions +from tangostationcontrol.devices.device_decorators import * +from tangostationcontrol.common.entrypoint import entry +from tangostationcontrol.clients.attribute_wrapper import attribute_wrapper +from tangostationcontrol.devices.opcua_device import opcua_device +from tangostationcontrol.common.lofar_logging import device_logging_to_python, log_exceptions __all__ = ["APSPU", "main"] + @device_logging_to_python() class APSPU(opcua_device): # ----------------- @@ -71,17 +63,10 @@ class APSPU(opcua_device): # Commands # -------- + # ---------- # Run server # ---------- -def main(args=None, **kwargs): - """Main function of the APSPU module.""" - - from common.lofar_logging import configure_logger - configure_logger() - - return run((APSPU,), args=args, **kwargs) - - -if __name__ == '__main__': - main() +def main(**kwargs): + """Main function of the ObservationControl module.""" + return entry(APSPU, **kwargs)