Skip to content
Snippets Groups Projects
Commit 31bc380b authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

Merge branch 'master' into L2SS-480-delays-to-beam-weights

parents d6051a2f fa162a94
No related branches found
No related tags found
1 merge request!220Resolve L2SS-480 "Delays to beam weights"
version: '2'
services:
archiver-maria-db:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/mariadb_hdbpp:2021-05-28
container_name: ${CONTAINER_NAME_PREFIX}archiver-maria-db
networks:
- control
ports:
- "3307:3306/tcp"
depends_on:
- databaseds
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=hdbpp
- MYSQL_HOST=archiver-maria-db:3306
- MYSQL_USER=tango
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- TANGO_HOST=${TANGO_HOST}
logging:
driver: syslog
options:
syslog-address: udp://${LOG_HOSTNAME}:1514
syslog-format: rfc3164
tag: "{{.Name}}"
restart: unless-stopped
hdbpp-es:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-archiver:2021-05-28
networks:
- control
container_name: ${CONTAINER_NAME_PREFIX}hdbpp-es
depends_on:
- databaseds
- dsconfig
- archiver-maria-db
environment:
- TANGO_HOST=${TANGO_HOST}
- HdbManager=archiving/hdbpp/confmanager01
command: >
/bin/bash -c "
wait-for-it.sh archiver-maria-db:3306 --timeout=30 --strict --
wait-for-it.sh ${TANGO_HOST} --timeout=30 --strict --
hdbppes-srv 01"
logging:
driver: syslog
options:
syslog-address: udp://${LOG_HOSTNAME}:1514
syslog-format: rfc3164
tag: "{{.Name}}"
restart: unless-stopped
hdbpp-es2:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-archiver:2021-05-28
networks:
- control
container_name: hdbpp-es2
depends_on:
- databaseds
- dsconfig
- archiver-maria-db
environment:
- TANGO_HOST=${TANGO_HOST}
- HdbManager=archiving/hdbpp/confmanager01
command: >
/bin/bash -c "
wait-for-it.sh archiver-maria-db:3306 --timeout=30 --strict --
wait-for-it.sh ${TANGO_HOST} --timeout=30 --strict --
hdbppes-srv 03"
restart: unless-stopped
hdbpp-cm:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-archiver:${TANGO_ARCHIVER_VERSION}
networks:
- control
container_name: ${CONTAINER_NAME_PREFIX}hdbpp-cm
depends_on:
- databaseds
- dsconfig
- archiver-maria-db
environment:
- TANGO_HOST=${TANGO_HOST}
- HdbManager=archiving/hdbpp/confmanager01
command: >
/bin/bash -c "
wait-for-it.sh archiver-maria-db:3306 --timeout=30 --strict --
wait-for-it.sh ${TANGO_HOST} --timeout=30 --strict --
hdbppcm-srv 01"
logging:
driver: syslog
options:
syslog-address: udp://${LOG_HOSTNAME}:1514
syslog-format: rfc3164
tag: "{{.Name}}"
dsconfig:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-dsconfig:${TANGO_DSCONFIG_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}dsconfig
networks:
- control
depends_on:
- databaseds
environment:
- TANGO_HOST=${TANGO_HOST}
command: >
sh -c "wait-for-it.sh ${TANGO_HOST} --timeout=30 --strict --
json2tango -w -a -u /tango-archiver/data/archiver-devices.json &&
sleep infinity"
volumes:
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome
- ../docker/tango/tango-archiver:/tango-archiver
logging:
driver: syslog
options:
syslog-address: udp://${LOG_HOSTNAME}:1514
syslog-format: rfc3164
tag: "{{.Name}}"
restart: unless-stopped
#
# Docker compose file that launches Astor, sending the display to a remote X11
# display.
#
# Defines:
# - astor: service that runs Astor in a container
# - container1: example container running Starter device
#
# Requires:
# - tango.yml
#
version: '2'
services:
astor:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-java:${TANGO_JAVA_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}astor
networks:
- control
volumes:
- ${XAUTHORITY_MOUNT}
environment:
- XAUTHORITY=${XAUTHORITY}
- DISPLAY=${DISPLAY}
- TANGO_HOST=${TANGO_HOST}
entrypoint:
- /usr/local/bin/wait-for-it.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
- /usr/local/bin/astor
starter-example:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-starter:${TANGO_STARTER_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}starter-example
networks:
- control
# set the hostname, otherwise duplicate device registrations result every
# time the hostname changes as the container is restarted.
hostname: starter-example
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
- /usr/local/bin/wait-for-it.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
- /usr/bin/supervisord
- --configuration
- /etc/supervisor/supervisord.conf
#
# Docker compose file that launches HdbViewer, sending the display to a remote X11
# display.
#
#
# Requires:
# - tango.yml
#
version: '2'
services:
hdbpp-viewer:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/hdbpp_viewer:${TANGO_HDBPP_VIEWER_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}hdbpp-viewer
network_mode: host
depends_on:
- databaseds
- dsconfig
- archiver-maria-db
- hdbpp-es
- hdbpp-cm
volumes:
- ${XAUTHORITY_MOUNT}
environment:
- XAUTHORITY=${XAUTHORITY}
- DISPLAY=${DISPLAY}
- TANGO_HOST=localhost:10000
- HDB_TYPE=mysql
- HDB_MYSQL_HOST=localhost
- HDB_MYSQL_PORT=3307
- HDB_USER=tango
- HDB_PASSWORD=tango
- HDB_NAME=hdbpp
- CLASSPATH=JTango.jar:ATKCore.jar:ATKWidget.jar:jhdbviewer.jar:HDBPP.jar:jython.jar:jcalendar.jar
entrypoint:
- wait-for-it.sh
- localhost:10000
- --strict
- --
- ./hdbpp_viewer/hdbpp_viewer_script
#
# Docker compose file that launches Jive, sending output to a remote X11
# display.
#
# This container will always run on the same network as the host,
# to make sure the DISPLAY variable can be used verbatim. For the
# same reason, TANGO_HOST is hardcoded to be at localhost:10000:
# the docker network offering our tangodb also exposes it on port 10000
# on the host.
#
# Defines:
# - jive: container running Jive
#
# Requires:
# - tango.yml
#
version: '2'
services:
jive:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-java:${TANGO_JAVA_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}jive
network_mode: host
volumes:
- ${XAUTHORITY_MOUNT}
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome
environment:
- XAUTHORITY=${XAUTHORITY}
- DISPLAY=${DISPLAY}
- TANGO_HOST=localhost:10000
entrypoint:
- /usr/local/bin/wait-for-it.sh
- localhost:10000
- --timeout=30
- --strict
- --
- /usr/local/bin/jive
#
# Docker compose file that launches LogViewer, sending output to a remote X11
# display.
#
# Defines:
# - logviewer: container running LogViewer
#
# Requires:
# - tango.yml
#
version: '2'
services:
logviewer:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-java:${TANGO_JAVA_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}logviewer
networks:
- control
volumes:
- ${XAUTHORITY_MOUNT}
environment:
- XAUTHORITY=${XAUTHORITY}
- DISPLAY=${DISPLAY}
- TANGO_HOST=${TANGO_HOST}
entrypoint:
- /usr/local/bin/wait-for-it.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
- /usr/local/bin/logviewer
#
# Docker compose file that launches Pogo, sending the display to a remote X11
# display. Pogo output can be persisted by writing to either:
# 1. the /home/tango folder, which is a Docker volume persisted between
# container runs;
# 2. the /hosthome folder, which is a r/w mount of your home folder.
#
# Defines:
# - pogo (service): service running Pogo
# - pogo (volume): persistent volume for writing Pogo outut
#
# Requires:
# - N/A
#
version: '2'
# Create a volume so that Pogo preferences and Pogo output can be persisted
volumes:
pogo: {}
services:
pogo:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-pogo:${TANGO_POGO_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}pogo
networks:
- control
volumes:
- pogo:/home/tango
- ${XAUTHORITY_MOUNT}
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome:rw
environment:
- XAUTHORITY=${XAUTHORITY}
- DISPLAY=${DISPLAY}
...@@ -68,3 +68,29 @@ services: ...@@ -68,3 +68,29 @@ services:
syslog-format: rfc3164 syslog-format: rfc3164
tag: "{{.Name}}" tag: "{{.Name}}"
restart: unless-stopped restart: unless-stopped
dsconfig:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-dsconfig:${TANGO_DSCONFIG_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}dsconfig
networks:
- control
depends_on:
- databaseds
environment:
- TANGO_HOST=${TANGO_HOST}
command: >
sh -c "wait-for-it.sh ${TANGO_HOST} --timeout=30 --strict --
json2tango -w -a -u /tango-archiver/data/archiver-devices.json &&
sleep infinity"
volumes:
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome
- ../docker/tango/tango-archiver:/tango-archiver
logging:
driver: syslog
options:
syslog-address: udp://${LOG_HOSTNAME}:1514
syslog-format: rfc3164
tag: "{{.Name}}"
restart: unless-stopped
#
# Docker compose file for TANGO test device server.
#
# Defines:
# - tangotest: TANGO test device server
#
# Requires:
# - tango.yml
#
version: '2'
services:
tangotest:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-java:${TANGO_JAVA_VERSION}
container_name: ${CONTAINER_NAME_PREFIX}tangotest
networks:
- control
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
- /usr/local/bin/wait-for-it.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
- /usr/local/bin/TangoTest
- test
restart: unless-stopped
...@@ -145,13 +145,38 @@ class attribute_wrapper(attribute): ...@@ -145,13 +145,38 @@ class attribute_wrapper(attribute):
return value return value
def _decorate_read_function(self, read_attr_func):
""" Wrap an attribute read function to annotate its exceptions with our
comms_annotation to be able to identify which attribute triggered the error. """
def wrapper():
try:
return read_attr_func()
except Exception as e:
raise Exception(f"Failed to read attribute {self.comms_annotation}") from e
return wrapper
def _decorate_write_function(self, write_attr_func):
""" Wrap an attribute write function to annotate its exceptions with our
comms_annotation to be able to identify which attribute triggered the error. """
def wrapper(value):
try:
write_attr_func(value)
except Exception as e:
raise Exception(f"Failed to write attribute {self.comms_annotation}") from e
return wrapper
def set_comm_client(self, client): def set_comm_client(self, client):
""" """
takes a communications client as input arguments This client should be of a class containing a "get_mapping" function takes a communications client as input arguments This client should be of a class containing a "get_mapping" function
and return a read and write function that the wrapper will use to get/set data. and return a read and write function that the wrapper will use to get/set data.
""" """
try: try:
self.read_function, self.write_function = client.setup_attribute(self.comms_annotation, self) read_attr_func, write_attr_func = client.setup_attribute(self.comms_annotation, self)
self.read_function = self._decorate_read_function(read_attr_func)
self.write_function = self._decorate_write_function(write_attr_func)
except Exception as e: except Exception as e:
raise Exception(f"Exception while setting {client.__class__.__name__} attribute with annotation: '{self.comms_annotation}'") from e raise Exception(f"Exception while setting {client.__class__.__name__} attribute with annotation: '{self.comms_annotation}'") from e
...@@ -160,7 +185,10 @@ class attribute_wrapper(attribute): ...@@ -160,7 +185,10 @@ class attribute_wrapper(attribute):
Asynchronous version of set_comm_client. Asynchronous version of set_comm_client.
""" """
try: try:
self.read_function, self.write_function = await client.setup_attribute(self.comms_annotation, self) read_attr_func, write_attr_func = await client.setup_attribute(self.comms_annotation, self)
self.read_function = self._decorate_read_function(read_attr_func)
self.write_function = self._decorate_write_function(write_attr_func)
except Exception as e: except Exception as e:
raise Exception(f"Exception while setting {client.__class__.__name__} attribute with annotation: '{self.comms_annotation}'") from e raise Exception(f"Exception while setting {client.__class__.__name__} attribute with annotation: '{self.comms_annotation}'") from e
......
...@@ -21,7 +21,7 @@ def only_in_states(allowed_states, log=True): ...@@ -21,7 +21,7 @@ def only_in_states(allowed_states, log=True):
if log: if log:
logger.warning(f"Illegal command: Function {func.__name__} can only be called in states {allowed_states}. Current state: {self.get_state()}") logger.warning(f"Illegal command: Function {func.__name__} can only be called in states {allowed_states}. Current state: {self.get_state()}")
Except.throw_exception(f"IllegalCommand: Function {func.__name__} can only be called in states {allowed_states}. Current state: {self.get_state()}") raise Exception(f"IllegalCommand: Function {func.__name__} can only be called in states {allowed_states}. Current state: {self.get_state()}")
return state_check_wrapper return state_check_wrapper
......
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