diff --git a/apps/installation/__init__.py b/apps/installation/__init__.py index 96b893ad56..cea811c51e 100644 --- a/apps/installation/__init__.py +++ b/apps/installation/__init__.py @@ -23,7 +23,7 @@ def trigger_first_time(sender, **kwargs): @transaction.commit_on_success def check_first_run(): try: - details = Installation.objects.get() + details = Installation.get() except DatabaseError: # Avoid database errors when the app tables haven't been created yet transaction.rollback() diff --git a/apps/job_processor/__init__.py b/apps/job_processor/__init__.py index 1568baa723..a9b2542cb0 100644 --- a/apps/job_processor/__init__.py +++ b/apps/job_processor/__init__.py @@ -1,6 +1,9 @@ from __future__ import absolute_import +import logging + from django.db import transaction, DatabaseError +from django.dispatch import receiver from django.utils.translation import ugettext_lazy as _ from scheduler.api import LocalScheduler @@ -10,6 +13,7 @@ from project_setup.api import register_setup from common.utils import encapsulate from clustering.models import Node +from clustering.signals import node_died from .models import JobQueue, JobProcessingConfig from .tasks import job_queue_poll @@ -17,6 +21,8 @@ from .links import (node_workers, job_queues, tool_link, job_queue_items_pending, job_queue_items_error, job_queue_items_active, job_queue_config_edit, setup_link, job_queue_start, job_queue_stop) +logger = logging.getLogger(__name__) + @transaction.commit_on_success def add_job_queue_jobs(): @@ -45,3 +51,9 @@ register_model_list_columns(Node, [ 'attribute': encapsulate(lambda x: x.workers().all().count()) }, ]) + + +@receiver(node_died, dispatch_uid='process_dead_workers') +def process_dead_workers(sender, **kwargs): + logger.debug('kwargs') + logger.debug(kwargs)