Commit de1117bb authored by Daniele Venzano's avatar Daniele Venzano

Automatic execution termination fixes

parent 0ef08483
...@@ -162,7 +162,7 @@ class APIEndpoint: ...@@ -162,7 +162,7 @@ class APIEndpoint:
for execution in all_execs: for execution in all_execs:
if execution.status == execution.RUNNING_STATUS: if execution.status == execution.RUNNING_STATUS:
for service in execution.services: for service in execution.services:
if service.description['monitor'] and service.docker_status == service.DOCKER_DIE_STATUS: if service.description['monitor'] and service.docker_status == service.DOCKER_DIE_STATUS or service.docker_status == service.DOCKER_DESTROY_STATUS:
log.info("Service {} of execution {} died, terminating execution".format(service.name, execution.id)) log.info("Service {} of execution {} died, terminating execution".format(service.name, execution.id))
self.master.execution_terminate(execution.id) self.master.execution_terminate(execution.id)
break break
......
...@@ -51,12 +51,13 @@ class ZoeSwarmChecker(threading.Thread): ...@@ -51,12 +51,13 @@ class ZoeSwarmChecker(threading.Thread):
for service in service_list: for service in service_list:
assert isinstance(service, Service) assert isinstance(service, Service)
if service.status != service.DOCKER_START_STATUS: if service.status != service.DOCKER_START_STATUS:
pass continue
found = False found = False
for container in container_list: for container in container_list:
if container['id'] == service.docker_id: if container['id'] == service.docker_id:
found = True found = True
if container['status'] == 'exited': if container['status'] == 'exited':
log.info('resetting status of service {}, died with no event'.format(service.name))
service.set_docker_status(service.DOCKER_DIE_STATUS) service.set_docker_status(service.DOCKER_DIE_STATUS)
if not found: if not found:
service.set_docker_status(service.DOCKER_DESTROY_STATUS) service.set_docker_status(service.DOCKER_DESTROY_STATUS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment