Skip to content

Commit

Permalink
Fixes for unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Littman committed Jul 25, 2018
1 parent 1c12605 commit 7821ee6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions sfm/ui/migrations/0022_auto_20180725_0745.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('ui', '0021_auto_20180712_1310'),
]

operations = [
migrations.RunSQL('delete from apscheduler_jobs;')
migrations.RunSQL('drop table if exists apscheduler_jobs;')
]
8 changes: 5 additions & 3 deletions sfm/ui/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

0 comments on commit 7821ee6

Please sign in to comment.