diff --git a/bin/dump_ConfigDb.sh b/bin/dump_ConfigDb.sh index bbd97a2208381c2fcf39710b9f908814313bdd7b..7745c18482000fe2e7a726e27b6fa5eeae57e88e 100755 --- a/bin/dump_ConfigDb.sh +++ b/bin/dump_ConfigDb.sh @@ -1,6 +1,4 @@ -if [ ${#} -ne 1 ]; then - echo "You must provide a file name for the TANGO_HOST DB dump!" - exit -1 -fi +#!/bin/bash -docker exec -it dsconfig python -m dsconfig.dump > ${1} +# writes the JSON dump to stdout +docker exec -it dsconfig python -m dsconfig.dump diff --git a/devices/devices/docker_device.py b/devices/devices/docker_device.py index 81abc26ee8ba4021b8e52bcefcf420a20cbdf28a..2acf7aeecf04755b71337d42f6a64946ef7cd54a 100644 --- a/devices/devices/docker_device.py +++ b/devices/devices/docker_device.py @@ -31,7 +31,6 @@ from clients.docker_client import DockerClient from clients.attribute_wrapper import attribute_wrapper from devices.hardware_device import hardware_device from common.lofar_logging import device_logging_to_python, log_exceptions -from common.lofar_git import get_version __all__ = ["Docker", "main"] @@ -50,7 +49,6 @@ class Docker(hardware_device): # ---------- # Attributes # ---------- - version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version()) archiver_maria_db_R = attribute_wrapper(comms_annotation={"container": "archiver-maria-db"}, datatype=numpy.bool_) archiver_maria_db_RW = attribute_wrapper(comms_annotation={"container": "archiver-maria-db"}, datatype=numpy.bool_, access=AttrWriteType.READ_WRITE) databaseds_R = attribute_wrapper(comms_annotation={"container": "databaseds"}, datatype=numpy.bool_) diff --git a/devices/devices/hardware_device.py b/devices/devices/hardware_device.py index a3abdb400466c9f601b0b85b7532ad2fb34f2aed..84d8e4c2b9c6156c994715416bebf38f979903b6 100644 --- a/devices/devices/hardware_device.py +++ b/devices/devices/hardware_device.py @@ -14,16 +14,17 @@ from abc import abstractmethod # PyTango imports -from tango.server import Device, command, attribute -from tango import DevState, DebugIt, Attribute, DeviceProxy +from tango.server import Device, command, DeviceMeta, attribute +from tango import DevState, DebugIt, Attribute, DeviceProxy, AttrWriteType # Additional import from clients.attribute_wrapper import attribute_wrapper from common.lofar_logging import log_exceptions -import time -import math +from common.lofar_git import get_version from devices.abstract_device import AbstractDeviceMetas from devices.device_decorators import only_in_states, fault_on_error +import time +import math import logging @@ -59,6 +60,8 @@ class hardware_device(Device, metaclass=AbstractDeviceMetas): The user triggers their transitions by the commands reflecting the target state (Initialise(), On(), Fault()). """ + version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version()) + # list of property names too be set first by set_defaults first_default_settings = [] diff --git a/devices/devices/opcua_device.py b/devices/devices/opcua_device.py index d95a8426ed0dc260c0f6eb6d85149e3f5f0ec4ba..698df95705b0dce00cb869ed880a29f97d472cb1 100644 --- a/devices/devices/opcua_device.py +++ b/devices/devices/opcua_device.py @@ -29,7 +29,6 @@ from devices.device_decorators import * from clients.opcua_client import OPCUAConnection from devices.hardware_device import hardware_device from common.lofar_logging import device_logging_to_python, log_exceptions -from common.lofar_git import get_version __all__ = ["opcua_device", "main"] diff --git a/devices/devices/recv.py b/devices/devices/recv.py index 7db40acc5c7dc4f04b8df1fb02185cf9eefcfb02..40efb14354471021e0a3d03feab865141422bbc7 100644 --- a/devices/devices/recv.py +++ b/devices/devices/recv.py @@ -30,7 +30,6 @@ 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 common.lofar_git import get_version __all__ = ["RECV", "main"] @@ -61,7 +60,6 @@ class RECV(opcua_device): # ---------- # Attributes # ---------- - version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version()) Ant_mask_RW = attribute_wrapper(comms_annotation=["2:PCC", "2:Ant_mask_RW"], datatype=numpy.bool_, dims=(3, 32), access=AttrWriteType.READ_WRITE) Ant_status_R = attribute(dtype=str, max_dim_x=3, max_dim_y=32) CLK_Enable_PWR_R = attribute_wrapper(comms_annotation=["2:PCC", "2:CLK_Enable_PWR_R"], datatype=numpy.bool_) diff --git a/devices/devices/sdp/sdp.py b/devices/devices/sdp/sdp.py index 221afb245361d4f330aab42b395532624fb4edde..693fab3a9b912a3e8e3e30d58dc237be6149df56 100644 --- a/devices/devices/sdp/sdp.py +++ b/devices/devices/sdp/sdp.py @@ -28,7 +28,6 @@ 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 common.lofar_git import get_version import numpy @@ -78,8 +77,6 @@ class SDP(opcua_device): # Attributes # ---------- - version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version()) - FPGA_beamlet_output_enable_R = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_enable_R"], datatype=numpy.bool_, dims=(16,)) FPGA_beamlet_output_enable_RW = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_enable_RW"], datatype=numpy.bool_, dims=(16,), access=AttrWriteType.READ_WRITE) FPGA_beamlet_output_hdr_eth_destination_mac_R = attribute_wrapper(comms_annotation=["2:FPGA_beamlet_output_hdr_eth_destination_mac_R"], datatype=numpy.str, dims=(16,)) diff --git a/devices/devices/sdp/statistics.py b/devices/devices/sdp/statistics.py index a884783ddd85c669e35a2230e72e3e4ca2f85d60..63f1cb0a7b1d2763fc51fa79abfa6317684bfd38 100644 --- a/devices/devices/sdp/statistics.py +++ b/devices/devices/sdp/statistics.py @@ -31,7 +31,6 @@ from clients.attribute_wrapper import attribute_wrapper from devices.opcua_device import opcua_device -from common.lofar_git import get_version from common.lofar_logging import device_logging_to_python, log_exceptions import logging @@ -67,8 +66,6 @@ class Statistics(opcua_device, metaclass=ABCMeta): # Attributes # ---------- - version_R = attribute(dtype = str, access = AttrWriteType.READ, fget = lambda self: get_version()) - # number of UDP packets and bytes that were received nof_packets_received_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "udp", "parameter": "nof_packets_received"}, datatype=numpy.uint64) nof_bytes_received_R = attribute_wrapper(comms_id=StatisticsClient, comms_annotation={"type": "udp", "parameter": "nof_bytes_received"}, datatype=numpy.uint64) diff --git a/devices/devices/unb2.py b/devices/devices/unb2.py index 83fb44ca93cb38795cc77b49354aa53dfafc5cf8..e2f781a24e5e59c52591f0826e36000a38687aa1 100644 --- a/devices/devices/unb2.py +++ b/devices/devices/unb2.py @@ -27,7 +27,6 @@ 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 common.lofar_git import get_version import numpy @@ -43,8 +42,6 @@ class UNB2(opcua_device): # Attributes # ---------- - version_R = attribute(dtype=str, access=AttrWriteType.READ, fget=lambda self: get_version()) - N_unb = 2 N_fpga = 4 N_ddr = 2 diff --git a/docker-compose/device-docker.yml b/docker-compose/device-docker.yml index 01d4ad44a95a7181e6d3af0937fed17f8904fbe3..d9e1e1e35233177ab271db395773538ed8c74ffa 100644 --- a/docker-compose/device-docker.yml +++ b/docker-compose/device-docker.yml @@ -29,7 +29,7 @@ services: volumes: - ..:/opt/lofar/tango:rw - /var/run/docker.sock:/var/run/docker.sock:rw # we want to control our sibling containers, NOT do docker-in-docker (dind) - user: ${CONTAINER_EXECUTION_UID}:${DOCKER_GID} # user that starts this container by definition has access rights to docker + user: 1000:${DOCKER_GID} # uid 1000 is the default "tango" user environment: - TANGO_HOST=${TANGO_HOST} entrypoint: diff --git a/sbin/load_ConfigDb.sh b/sbin/load_ConfigDb.sh index e62092969301662f5714ce88f028c97b427cc9c8..03ab449a026b5de41056f16de0d2e566a00adfbb 100755 --- a/sbin/load_ConfigDb.sh +++ b/sbin/load_ConfigDb.sh @@ -9,7 +9,10 @@ fi # copy file into container to read it from container, as the file's location # in the container won't be the same as on the host. -docker cp "${file}" dsconfig:/tmp/dsconfig-load-settings.json +docker cp "${file}" dsconfig:/tmp/dsconfig-load-settings.json || exit 1 # write settings docker exec -it dsconfig json2tango --write /tmp/dsconfig-load-settings.json + +# somehow json2tango does not return 0 on success +exit 0 diff --git a/sbin/run_integration_test.sh b/sbin/run_integration_test.sh index 3b7c09e511a26be4e2c403acb1ed557e8046b463..9d9ec12ae79a2336d5bfd88191930f8c6fa9db36 100755 --- a/sbin/run_integration_test.sh +++ b/sbin/run_integration_test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e if [ -z "$LOFA20_DIR"]; then # We assume we aren't in the PATH, so we can derive our path. @@ -18,7 +18,7 @@ make start databaseds dsconfig jupyter elk sleep 15 # Update the dsconfig -sbin/update_ConfigDb.sh CDB/integration_ConfigDb.json +${LOFAR20_DIR}/sbin/update_ConfigDb.sh ${LOFAR20_DIR}/CDB/integration_ConfigDb.json cd "$LOFAR20_DIR/docker-compose" || exit 1 make start sdptr-sim recv-sim unb2-sim diff --git a/sbin/update_ConfigDb.sh b/sbin/update_ConfigDb.sh index 90cf92c2418586edf3194f2b0d422040c0f8c7de..8d71c312fc94ba4dba45b17c05a966f62fa9ff34 100755 --- a/sbin/update_ConfigDb.sh +++ b/sbin/update_ConfigDb.sh @@ -9,7 +9,10 @@ fi # copy file into container to read it from container, as the file's location # in the container won't be the same as on the host. -docker cp "${file}" dsconfig:/tmp/dsconfig-update-settings.json +docker cp "${file}" dsconfig:/tmp/dsconfig-update-settings.json || exit 1 # update settings docker exec -it dsconfig json2tango --write --update /tmp/dsconfig-update-settings.json + +# somehow json2tango does not return 0 on success +exit 0