From 3f28d6990cd86ac6c41c0b0bebb405dd4c009503 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Fri, 6 Aug 2021 13:21:27 +0200 Subject: [PATCH] L2SS-271: Moved from deprecated isAlive to is_alive when using threading.Thread. --- devices/clients/statistics_client.py | 4 ++-- devices/clients/udp_receiver.py | 6 +++--- devices/devices/sdp/statistics_collector.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/devices/clients/statistics_client.py b/devices/clients/statistics_client.py index 65f2cbb20..5d45ac472 100644 --- a/devices/clients/statistics_client.py +++ b/devices/clients/statistics_client.py @@ -60,10 +60,10 @@ class StatisticsClient(CommClient): return super().connect() def ping(self): - if not self.statistics.isAlive(): + if not self.statistics.is_alive(): raise Exception("Statistics processing thread died unexpectedly") - if not self.udp.isAlive(): + if not self.udp.is_alive(): raise Exception("UDP thread died unexpectedly") def disconnect(self): diff --git a/devices/clients/udp_receiver.py b/devices/clients/udp_receiver.py index cca308cce..13f68f509 100644 --- a/devices/clients/udp_receiver.py +++ b/devices/clients/udp_receiver.py @@ -81,7 +81,7 @@ class UDPReceiver(Thread): super().join(timeout) - if self.isAlive(): + if self.is_alive(): # happens if timeout is hit return @@ -89,13 +89,13 @@ class UDPReceiver(Thread): self.sock.shutdown(socket.SHUT_RDWR) def disconnect(self): - if not self.isAlive(): + if not self.is_alive(): return # try to get the thread shutdown, but don't stall forever self.join(self.DISCONNECT_TIMEOUT) - if self.isAlive(): + if self.is_alive(): # there is nothing we can do except wait (stall) longer, which could be indefinitely. logger.error(f"UDP thread for {self.host}:{self.port} did not shut down after {self.DISCONNECT_TIMEOUT} seconds, just leaving it dangling. Please attach a debugger to thread ID {self.ident}.") diff --git a/devices/devices/sdp/statistics_collector.py b/devices/devices/sdp/statistics_collector.py index 266eb451c..f7d01d2cb 100644 --- a/devices/devices/sdp/statistics_collector.py +++ b/devices/devices/sdp/statistics_collector.py @@ -67,13 +67,13 @@ class StatisticsCollector(Thread): super().join(timeout) def disconnect(self): - if not self.isAlive(): + if not self.is_alive(): return # try to get the thread shutdown, but don't stall forever self.join(self.DISCONNECT_TIMEOUT) - if self.isAlive: + if self.is_alive(): # there is nothing we can do except wait (stall) longer, which could be indefinitely. logger.error(f"Statistics thread did not shut down after {self.DISCONNECT_TIMEOUT} seconds, just leaving it dangling. Please attach a debugger to thread ID {self.ident}.") -- GitLab