Skip to content
Snippets Groups Projects
Commit 002648cd authored by Thomas Juerges's avatar Thomas Juerges
Browse files

Merge branch 'master' into...

Merge branch 'master' into 2021-03-22T15.58.03-branched_from_master-fix_ipython_completion_in_itango
parents 6b97d7b3 0893a6f7
No related branches found
No related tags found
1 merge request!9This fixes the itango completion bug
...@@ -87,6 +87,10 @@ class PCC(Device): ...@@ -87,6 +87,10 @@ class PCC(Device):
# Attributes # Attributes
# ---------- # ----------
RCU_state_R = attribute(
dtype = (numpy.str),
)
RCU_mask_RW = attribute( RCU_mask_RW = attribute(
dtype=(numpy.bool_,), dtype=(numpy.bool_,),
max_dim_x=32, max_dim_x=32,
...@@ -204,6 +208,11 @@ class PCC(Device): ...@@ -204,6 +208,11 @@ class PCC(Device):
access=AttrWriteType.READ_WRITE, access=AttrWriteType.READ_WRITE,
) )
uC_ID_R = attribute(
dtype=(numpy.int64,),
max_dim_x=32,
)
RCU_monitor_rate_RW = attribute( RCU_monitor_rate_RW = attribute(
dtype=numpy.float_, dtype=numpy.float_,
access=AttrWriteType.READ_WRITE, access=AttrWriteType.READ_WRITE,
...@@ -233,6 +242,8 @@ class PCC(Device): ...@@ -233,6 +242,8 @@ class PCC(Device):
self.debug_stream("Mapping OPC-UA MP/CP to attributes...") self.debug_stream("Mapping OPC-UA MP/CP to attributes...")
self.attribute_mapping["RCU_state_R"] = self.get_pcc_node("RCU_state_R")
self.attribute_mapping["RCU_mask_RW"] = self.get_pcc_node("RCU_mask_RW") self.attribute_mapping["RCU_mask_RW"] = self.get_pcc_node("RCU_mask_RW")
self.attribute_mapping["Ant_mask_RW"] = self.get_pcc_node("Ant_mask_RW") self.attribute_mapping["Ant_mask_RW"] = self.get_pcc_node("Ant_mask_RW")
...@@ -277,6 +288,8 @@ class PCC(Device): ...@@ -277,6 +288,8 @@ class PCC(Device):
self.attribute_mapping["HBA_element_pwr_RW"] = self.get_pcc_node("HBA_element_pwr_RW") self.attribute_mapping["HBA_element_pwr_RW"] = self.get_pcc_node("HBA_element_pwr_RW")
self.attribute_mapping["uC_ID_R"] = self.get_pcc_node("uC_ID _R")
self.attribute_mapping["RCU_monitor_rate_RW"] = self.get_pcc_node("RCU_monitor_rate_RW") self.attribute_mapping["RCU_monitor_rate_RW"] = self.get_pcc_node("RCU_monitor_rate_RW")
self.function_mapping["RCU_off"] = self.get_pcc_node("RCU_off") self.function_mapping["RCU_off"] = self.get_pcc_node("RCU_off")
...@@ -314,6 +327,9 @@ class PCC(Device): ...@@ -314,6 +327,9 @@ class PCC(Device):
# Set default values in the RW/R attributes and add them to # Set default values in the RW/R attributes and add them to
# the mapping. # the mapping.
self._RCU_state_R = ""
self.attribute_mapping["RCU_state_R"] = {}
self._RCU_mask_RW = numpy.full(32, False) self._RCU_mask_RW = numpy.full(32, False)
self.attribute_mapping["RCU_mask_RW"] = {} self.attribute_mapping["RCU_mask_RW"] = {}
...@@ -380,6 +396,9 @@ class PCC(Device): ...@@ -380,6 +396,9 @@ class PCC(Device):
self._HBA_element_pwr_RW = numpy.full((96, 32), 0) self._HBA_element_pwr_RW = numpy.full((96, 32), 0)
self.attribute_mapping["HBA_element_pwr_RW"] = {} self.attribute_mapping["HBA_element_pwr_RW"] = {}
self._uC_ID_R = numpy.full(32, 0)
self.attribute_mapping["uC_ID_R"] = {}
self._RCU_monitor_rate_RW = 30.0 self._RCU_monitor_rate_RW = 30.0
self.attribute_mapping["RCU_monitor_rate_RW"] = {} self.attribute_mapping["RCU_monitor_rate_RW"] = {}
...@@ -450,6 +469,13 @@ class PCC(Device): ...@@ -450,6 +469,13 @@ class PCC(Device):
# ------------------ # ------------------
# Attributes methods # Attributes methods
# ------------------ # ------------------
@only_when_on
@fault_on_error
def read_RCU_state_R(self):
"""Return the RCU_state_R attribute."""
self._RCU_state_R = self.attribute_mapping["RCU_state_R"].get_value()
return self._RCU_state_R
@only_when_on @only_when_on
@fault_on_error @fault_on_error
def read_RCU_mask_R(self): def read_RCU_mask_R(self):
...@@ -675,6 +701,13 @@ class PCC(Device): ...@@ -675,6 +701,13 @@ class PCC(Device):
self.attribute_mapping["HBA_element_pwr_RW"].set_value(value.flatten().tolist()) self.attribute_mapping["HBA_element_pwr_RW"].set_value(value.flatten().tolist())
self._HBA_element_pwr_RW = value self._HBA_element_pwr_RW = value
@only_when_on
@fault_on_error
def read_uC_ID_R(self):
"""Return the uC_ID_R attribute."""
self._uC_ID_R = numpy.array(self.attribute_mapping["uC_ID_R"].get_value())
return self._uC_ID_R
@only_when_on @only_when_on
@fault_on_error @fault_on_error
def read_RCU_monitor_rate_RW(self): def read_RCU_monitor_rate_RW(self):
......
...@@ -92,6 +92,8 @@ pull: ## pull the images from the Docker hub ...@@ -92,6 +92,8 @@ pull: ## pull the images from the Docker hub
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) pull $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) pull
build: ## rebuild images build: ## rebuild images
# docker-compose does not support build dependencies, so manage those here
$(DOCKER_COMPOSE_ARGS) docker-compose -f lofar-device-base.yml build
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) build $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) build
up: minimal ## start the base TANGO system and prepare all services up: minimal ## start the base TANGO system and prepare all services
...@@ -122,6 +124,9 @@ attach: ## attach a service to an existing Tango network ...@@ -122,6 +124,9 @@ attach: ## attach a service to an existing Tango network
status: ## show the container status status: ## show the container status
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) ps $(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) ps
images: ## show the container images
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) images
clean: down ## clear all TANGO database entries clean: down ## clear all TANGO database entries
docker volume rm $(BASEDIR)_tangodb docker volume rm $(BASEDIR)_tangodb
......
#
# Docker compose file that launches an interactive iTango session.
#
# Connect to the interactive session with 'docker attach itango'.
# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
#
# Defines:
# - itango: iTango interactive session
#
# Requires:
# - lofar-device-base.yml
#
version: '2'
services:
device-pcc:
image: lofar-device-base
container_name: ${CONTAINER_NAME_PREFIX}device-pcc
network_mode: ${NETWORK_MODE}
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
- /usr/local/bin/wait-for-it.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
- python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/PCC/PCC LTS -v
restart: on-failure
#
# Docker compose file that launches an interactive iTango session.
#
# Connect to the interactive session with 'docker attach itango'.
# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
#
# Defines:
# - itango: iTango interactive session
#
# Requires:
# - lofar-device-base.yml
#
version: '2'
services:
device-sdp:
image: lofar-device-base
container_name: ${CONTAINER_NAME_PREFIX}device-sdp
network_mode: ${NETWORK_MODE}
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
- /usr/local/bin/wait-for-it.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
- python3 -u ${TANGO_LOFAR_CONTAINER_DIR}/SDP/SDP LTS -v
restart: on-failure
...@@ -37,3 +37,4 @@ services: ...@@ -37,3 +37,4 @@ services:
- --strict - --strict
- -- - --
- /venv/bin/itango3 - /venv/bin/itango3
restart: on-failure
...@@ -18,6 +18,7 @@ services: ...@@ -18,6 +18,7 @@ services:
volumes: volumes:
- ${TANGO_SKA_CONTAINER_MOUNT} - ${TANGO_SKA_CONTAINER_MOUNT}
- ${TANGO_LOFAR_CONTAINER_MOUNT} - ${TANGO_LOFAR_CONTAINER_MOUNT}
- ${TANGO_LOFAR_LOCAL_DIR}/jupyter-notebooks:/jupyter-notebooks:rw
- ${HOME}:/hosthome - ${HOME}:/hosthome
environment: environment:
- TANGO_HOST=${TANGO_HOST} - TANGO_HOST=${TANGO_HOST}
...@@ -25,7 +26,7 @@ services: ...@@ -25,7 +26,7 @@ services:
- DISPLAY=${DISPLAY} - DISPLAY=${DISPLAY}
ports: ports:
- "8888:8888" - "8888:8888"
working_dir: ${TANGO_LOFAR_CONTAINER_DIR}/jupyter-notebooks working_dir: /jupyter-notebooks
entrypoint: entrypoint:
- /usr/local/bin/wait-for-it.sh - /usr/local/bin/wait-for-it.sh
- ${TANGO_HOST} - ${TANGO_HOST}
...@@ -33,3 +34,4 @@ services: ...@@ -33,3 +34,4 @@ services:
- --strict - --strict
- -- - --
- /usr/bin/tini -- jupyter notebook --port=8888 --no-browser --ip=0.0.0.0 --allow-root --NotebookApp.token= --NotebookApp.password= - /usr/bin/tini -- jupyter notebook --port=8888 --no-browser --ip=0.0.0.0 --allow-root --NotebookApp.token= --NotebookApp.password=
restart: on-failure
#
# Docker compose file that forms the basis for LOFAR tango devices
#
# This is an abstract image that does not need to be spinned up, but
# might be out of consistency with other images.
#
# Defines:
# - device-base: Base configuration for devices.
#
# Requires:
# - tango.yml
#
version: '2'
services:
lofar-device-base:
image: lofar-device-base
build:
context: lofar-device-base
container_name: ${CONTAINER_NAME_PREFIX}lofar-device-base
network_mode: ${NETWORK_MODE}
FROM nexus.engageska-portugal.pt/ska-docker/tango-itango:latest
COPY lofar-requirements.txt /lofar-requirements.txt
RUN pip3 install -r /lofar-requirements.txt
opcua >= 0.98.9
astropy
...@@ -16,3 +16,4 @@ services: ...@@ -16,3 +16,4 @@ services:
- ${HOME}:/hosthome - ${HOME}:/hosthome
ports: ports:
- "4842:4842" - "4842:4842"
restart: on-failure
%% Cell type:code id:social-massachusetts tags:
``` python
def force_start(device):
if device.state() == DevState.FAULT:
device.Off()
if device.state() == DevState.OFF:
device.initialise()
if device.state() == DevState.INIT:
device.Standby()
if device.state() == DevState.STANDBY:
device.On()
return device.state()
```
%% Cell type:code id:defined-apache tags:
``` python
for d in devices:
print("Device %s is now in state %s" % (d, force_start(d)))
```
%% Output
Device PCC(lts/pcc/1) is now in state FAULT
Device SDP(lts/sdp/1) is now in state ON
%% Cell type:code id:superior-wheel tags:
``` python
```
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