Skip to content

Commit

Permalink
Fixed bug where thread keeps running, and uses method _sendCommand wh…
Browse files Browse the repository at this point in the history
…en its undefined
  • Loading branch information
Adir111 committed Aug 14, 2024
1 parent 0fa867c commit 18a673a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions hkube_python_wrapper/wrapper/algorunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
self._stopped = False
self._redirectLogs = False
self._printThread = 0
self._done = False
self._done = True
DaemonThread.__init__(self, "WorkerListener")

@staticmethod
Expand Down Expand Up @@ -319,10 +319,10 @@ def _getMethod(self, name):

def _aliveSignal(self):
def routine():
while not self._done:
time.sleep(5)
while not self._done and not self.stopped:
self._sendCommand(messages.outgoing.alive, None)
print("stopped is: ", self._stopped)
time.sleep(5)

thread = threading.Thread(target=routine)
thread.start()
Expand Down Expand Up @@ -357,7 +357,6 @@ def _init(self, options):
redirector.events.on_data -= self._log_message
redirector.cleanup()


def _discovery_update(self, discovery):
log.debug('Got discovery update {discovery}', discovery=discovery)
messageListenerConfig = {'encoding': config.discovery['encoding'], 'delay': config.discovery['delay']}
Expand Down

0 comments on commit 18a673a

Please sign in to comment.