Skip to content

Commit

Permalink
Temporary failed condition is checked
Browse files Browse the repository at this point in the history
  • Loading branch information
frankcorneliusmartin committed Nov 3, 2022
1 parent da0724f commit b13dad9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions vantage6-node/vantage6/node/docker/docker_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def run(self, result_id: int, image: str, docker_input: bytes,
# again. If it fails permanently we add it to the failed tasks to be
# handled by the speaking worker of the node
attempts = 1
while not (task.status == TaskStatus.STARTED) and attempts < 3 :
while not (task.status == TaskStatus.STARTED) and attempts < 3:
try:
vpn_ports = task.run(
docker_input=docker_input, tmp_vol_name=tmp_vol_name,
Expand All @@ -311,9 +311,9 @@ def run(self, result_id: int, image: str, docker_input: bytes,

attempts += 1


# keep track of the active container
if task.status == TaskStatus.FAILED:
if task.status == TaskStatus.FAILED \
or task.status == TaskStatus.PERMANENTLY_FAILED:
self.failed_tasks.append(task)
return None
else:
Expand Down
6 changes: 4 additions & 2 deletions vantage6-node/vantage6/node/docker/task_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ class TaskStatus(Enum):
# COMPLETED = 2
# Failed to start the container
FAILED = 90
PERMANENTLY_FAILED = 91
# Container had a non zero exit code
# CRASHED = 91
# CRASHED = 92

class DockerTaskManager(DockerBaseManager):
"""
Expand Down Expand Up @@ -271,10 +272,11 @@ def _run_algorithm(self) -> List[Dict]:

except docker.errors.ImageNotFound:
self.log.error(f'Could not find image: {self.image}')
self.status = TaskStatus.FAILED
self.status = TaskStatus.PERMANENTLY_FAILED
raise PermanentAlgorithmStartFail

except Exception as e:
self.status = TaskStatus.FAILED
raise UnknownAlgorithmStartFail(e)

self.status = TaskStatus.STARTED
Expand Down

0 comments on commit b13dad9

Please sign in to comment.