Commit 25304fa4 authored by Daniele Venzano's avatar Daniele Venzano

Fix pylint warnings

parent 5fd816f0
......@@ -19,7 +19,7 @@ import logging
import os
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from tornado.ioloop import IOLoop
from tornado.web import Application
import zoe_lib.config as config
......
......@@ -185,27 +185,7 @@ class ZoeElasticScheduler:
if len(self.queue) == 0:
log.debug("Scheduler loop has been triggered, but the queue is empty")
self.core_limit_recalc_trigger.set()
# Check for executions that are no longer viable since an essential service died
for execution in self.queue_running:
for service in execution.services:
if service.essential and service.backend_status == service.BACKEND_DIE_STATUS:
log.info("Essential service {} ({}) of execution {} died, terminating execution".format(service.id, service.name, execution.id))
service.restarted()
execution.set_cleaning_up()
self.terminate(execution)
break
# Check for executions that need to be rescheduled because one of the elastic components died
# Do it in two loops to prevent rescheduling executions that need to be terminated
for execution in self.queue_running:
for service in execution.services:
if not service.essential and service.backend_status == service.BACKEND_DIE_STATUS:
log.info("Elastic service {} ({}) of execution {} died, rescheduling".format(service.id, service.name, execution.id))
service.restarted()
self.queue_running.remove(execution)
self.queue.append(execution)
break
self._check_dead_services()
continue
log.debug("Scheduler loop has been triggered")
......@@ -356,3 +336,24 @@ class ZoeElasticScheduler:
update_service_resource_limits(service, cores=new_core_allocations[service.id] + cores_to_add)
self.core_limit_recalc_trigger.clear()
def _check_dead_services(self):
# Check for executions that are no longer viable since an essential service died
for execution in self.queue_running:
for service in execution.services:
if service.essential and service.backend_status == service.BACKEND_DIE_STATUS:
log.info("Essential service {} ({}) of execution {} died, terminating execution".format(service.id, service.name, execution.id))
service.restarted()
execution.set_cleaning_up()
self.terminate(execution)
break
# Check for executions that need to be rescheduled because one of the elastic components died
# Do it in two loops to prevent rescheduling executions that need to be terminated
for execution in self.queue_running:
for service in execution.services:
if not service.essential and service.backend_status == service.BACKEND_DIE_STATUS:
log.info("Elastic service {} ({}) of execution {} died, rescheduling".format(service.id, service.name, execution.id))
service.restarted()
self.queue_running.remove(execution)
self.queue.append(execution)
break
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