diff --git a/requirements/common.txt b/requirements/common.txt index 734f931e..f614660c 100644 --- a/requirements/common.txt +++ b/requirements/common.txt @@ -14,6 +14,8 @@ psycopg2-binary==2.7.5 pytz==2018.5 rabbitmq-admin==0.2 SQLAlchemy==1.2.9 +# Used when executing SQL in migration. +sqlparse==0.2.4 # Pinning to correct version for sfm-utils requests==2.19.1 diff --git a/sfm/ui/migrations/0022_auto_20180725_0745.py b/sfm/ui/migrations/0022_auto_20180725_0745.py index 0d742d0d..c970bbc1 100644 --- a/sfm/ui/migrations/0022_auto_20180725_0745.py +++ b/sfm/ui/migrations/0022_auto_20180725_0745.py @@ -2,7 +2,6 @@ from django.db import migrations - class Migration(migrations.Migration): dependencies = [ @@ -10,5 +9,5 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RunSQL('delete from apscheduler_jobs;') + migrations.RunSQL('drop table if exists apscheduler_jobs;') ] diff --git a/sfm/ui/monitoring.py b/sfm/ui/monitoring.py index f8b5aea1..509da170 100644 --- a/sfm/ui/monitoring.py +++ b/sfm/ui/monitoring.py @@ -2,7 +2,9 @@ from rabbitmq_admin import AdminAPI from django.conf import settings from .models import Harvest, Export +import logging +log = logging.getLogger(__name__) def monitor_harvests(): # From 3 days ago to the present. This will omit old activity. @@ -39,9 +41,9 @@ def list_queues(self): for queue in self._api_get("/api/queues"): queue_name = queue["name"].replace("_", " ").title() if queue_name.endswith("Harvester") or queue_name.endswith("Priority"): - harvester_queues[queue_name] = queue["messages"] + harvester_queues[queue_name] = queue.get("messages", 0) elif queue_name.endswith("Exporter"): - exporter_queues[queue_name] = queue["messages"] + exporter_queues[queue_name] = queue.get("messages", 0) elif queue_name.endswith("Ui"): - ui_queues[queue_name] = queue["messages"] + ui_queues[queue_name] = queue.get("messages", 0) return harvester_queues, exporter_queues, ui_queues