Skip to content

Commit

Permalink
Merge pull request #129 from kube-HPC/isAlive_minor_fix
Browse files Browse the repository at this point in the history
Handled error & stopped properly.
  • Loading branch information
Adir111 authored Aug 21, 2024
2 parents e16ed73 + e84d36e commit 5818f00
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hkube_python_wrapper/wrapper/algorunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(self):
self._redirectLogs = False
self._printThread = 0
self._done = True
self._error = False
DaemonThread.__init__(self, "WorkerListener")

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

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

thread = threading.Thread(target=routine)
Expand Down Expand Up @@ -575,6 +575,7 @@ def _sendCommand(self, command, data):

def sendError(self, error):
try:
self._error = True
log.error("Sending error to worker " + str(error))
self._wsc.send({
'command': messages.outgoing.error,
Expand Down

0 comments on commit 5818f00

Please sign in to comment.