Loading src/simap_connector/service/telemetry/TelemetryWorker.py +6 −3 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ # limitations under the License. import logging, threading, time import logging, math, threading, time from typing import Optional from simap_connector.service.simap_updater.SimapClient import SimapClient from .Resources import Resources Loading @@ -22,6 +22,9 @@ from .Resources import Resources LOGGER = logging.getLogger(__name__) WAIT_LOOP_GRANULARITY = 0.5 class TelemetryWorker(threading.Thread): def __init__( self, worker_name : str, simap_client : SimapClient, resources : Resources, Loading Loading @@ -54,11 +57,11 @@ class TelemetryWorker(threading.Thread): self._resources.generate_samples(self._simap_client) # Make wait responsible to terminations iterations = self._sampling_interval / 0.1 iterations = int(math.ceil(self._sampling_interval / WAIT_LOOP_GRANULARITY)) for _ in range(iterations): if self._stop_event.is_set(): break if self._terminate.is_set() : break time.sleep(0.1) time.sleep(WAIT_LOOP_GRANULARITY) except Exception: MSG = '[run][{:s}] Unhandled Exception' Loading Loading
src/simap_connector/service/telemetry/TelemetryWorker.py +6 −3 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ # limitations under the License. import logging, threading, time import logging, math, threading, time from typing import Optional from simap_connector.service.simap_updater.SimapClient import SimapClient from .Resources import Resources Loading @@ -22,6 +22,9 @@ from .Resources import Resources LOGGER = logging.getLogger(__name__) WAIT_LOOP_GRANULARITY = 0.5 class TelemetryWorker(threading.Thread): def __init__( self, worker_name : str, simap_client : SimapClient, resources : Resources, Loading Loading @@ -54,11 +57,11 @@ class TelemetryWorker(threading.Thread): self._resources.generate_samples(self._simap_client) # Make wait responsible to terminations iterations = self._sampling_interval / 0.1 iterations = int(math.ceil(self._sampling_interval / WAIT_LOOP_GRANULARITY)) for _ in range(iterations): if self._stop_event.is_set(): break if self._terminate.is_set() : break time.sleep(0.1) time.sleep(WAIT_LOOP_GRANULARITY) except Exception: MSG = '[run][{:s}] Unhandled Exception' Loading