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

Merge branch 'master' into L2SS-445-docker-logs

parents 457a4d62 ea573fcb
No related branches found
No related tags found
1 merge request!159L2SS-445: Forward logs from the Docker containers to ELK
...@@ -63,9 +63,10 @@ class CommClient(AbstractCommClient, Thread): ...@@ -63,9 +63,10 @@ class CommClient(AbstractCommClient, Thread):
def connect(self): def connect(self):
""" """
Function used to connect to the client. Function used to connect to the client.
Throws an Exception if the connection cannot be established.
""" """
self.connected = True self.connected = True
return True
def disconnect(self): def disconnect(self):
""" """
...@@ -74,22 +75,15 @@ class CommClient(AbstractCommClient, Thread): ...@@ -74,22 +75,15 @@ class CommClient(AbstractCommClient, Thread):
self.connected = False self.connected = False
def run(self): def run(self):
# Explicitly connect
if not self.connect():
# hardware or infra is down -- needs fixing first
self.fault_func()
return
self.stopping = False self.stopping = False
while not self.stopping: while not self.stopping:
# keep trying to connect
if not self.connected: if not self.connected:
if self.connect(): # we (re)try only once, to catch exotic network issues. if the infra or hardware is down,
pass
else:
# we retry only once, to catch exotic network issues. if the infra or hardware is down,
# our device cannot help, and must be reinitialised after the infra or hardware is fixed. # our device cannot help, and must be reinitialised after the infra or hardware is fixed.
try:
self.connect()
except Exception as e:
self.streams.error_stream("Fault condition in communication detected.", e)
self.fault_func() self.fault_func()
return return
......
...@@ -59,7 +59,6 @@ class OPCUAConnection(AsyncCommClient): ...@@ -59,7 +59,6 @@ class OPCUAConnection(AsyncCommClient):
try: try:
await self.client.connect() await self.client.connect()
self.connected = True
except (socket.error, IOError, OSError) as e: except (socket.error, IOError, OSError) as e:
raise IOError(f"Could not connect to OPC-UA server {self._servername()}") from e raise IOError(f"Could not connect to OPC-UA server {self._servername()}") from e
......
...@@ -22,10 +22,7 @@ class test_client(CommClient): ...@@ -22,10 +22,7 @@ class test_client(CommClient):
super().__init__(fault_func, streams, try_interval) super().__init__(fault_func, streams, try_interval)
# Explicitly connect # Explicitly connect
if not self.connect(): self.connect()
# hardware or infra is down -- needs fixing first
fault_func()
return
def connect(self): def connect(self):
""" """
...@@ -34,7 +31,6 @@ class test_client(CommClient): ...@@ -34,7 +31,6 @@ class test_client(CommClient):
self.streams.debug_stream("the example client doesn't actually connect to anything silly") self.streams.debug_stream("the example client doesn't actually connect to anything silly")
self.connected = True # set connected to true self.connected = True # set connected to true
return True # if succesfull, return true. otherwise return false
def disconnect(self): def disconnect(self):
self.connected = False # always force a reconnect, regardless of a successful disconnect self.connected = False # always force a reconnect, regardless of a successful disconnect
......
...@@ -8,7 +8,7 @@ TANGO_CPP_VERSION=9.3.5 ...@@ -8,7 +8,7 @@ TANGO_CPP_VERSION=9.3.5
TANGO_DB_VERSION=10.4.11 TANGO_DB_VERSION=10.4.11
TANGO_DSCONFIG_VERSION=1.5.1 TANGO_DSCONFIG_VERSION=1.5.1
TANGO_HDBPP_VIEWER_VERSION=2021-05-28 TANGO_HDBPP_VIEWER_VERSION=2021-05-28
TANGO_ITANGO_VERSION=9.3.5 TANGO_ITANGO_VERSION=9.3.7
TANGO_JAVA_VERSION=9.3.4 TANGO_JAVA_VERSION=9.3.4
TANGO_POGO_VERSION=9.6.32 TANGO_POGO_VERSION=9.6.32
TANGO_REST_VERSION=1.14.2 TANGO_REST_VERSION=1.14.2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment