From 6e0354b33901a3da40d54e21610d3f9793354fc7 Mon Sep 17 00:00:00 2001 From: Brian Moe <brian.moe@ligo.org> Date: Tue, 24 Jan 2012 21:28:25 -0600 Subject: [PATCH] Added IFAR chart to reports page. --- gracedb/reports.py | 10 ++++++++-- settings.py | 4 ++++ settings_dev.py | 6 +++++- templates/gracedb/histogram.html | 14 ++++++++++++-- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/gracedb/reports.py b/gracedb/reports.py index b6a072f7f..a2639a255 100644 --- a/gracedb/reports.py +++ b/gracedb/reports.py @@ -4,15 +4,21 @@ from django.template import RequestContext from django.shortcuts import render_to_response from django.conf import settings - +import os def histo(request): try: table = open(settings.LATENCY_REPORT_WEB_PAGE_FILE_PATH, "r").read() except IOError: table = "No Data Available" + if os.access(settings.REPORT_IFAR_IMAGE, os.R_OK): + ifar = settings.REPORT_IFAR_URL + else: + ifar = None return render_to_response( 'gracedb/histogram.html', - {'table': table}, + {'table': table, + 'ifar' : ifar, + }, context_instance=RequestContext(request)) diff --git a/settings.py b/settings.py index f6c935299..ae694d88f 100644 --- a/settings.py +++ b/settings.py @@ -75,6 +75,10 @@ LATENCY_REPORT_DEST_DIR = "/home/gracedb/data/latency" LATENCY_MAXIMUM_CHARTED = 1800 LATENCY_REPORT_WEB_PAGE_FILE_PATH = LATENCY_REPORT_DEST_DIR + "/latency.inc" +REPORT_CBC_IFAR_QUERY = "LowMass ER1 hasfar" +REPORT_IFAR_IMAGE = LATENCY_REPORT_DEST_DIR + "/ifar.png" +REPORT_IFAR_URL = "ifar.png" + # RSS Feed Defaults FEED_MAX_RESULTS = 50 diff --git a/settings_dev.py b/settings_dev.py index ced018094..f63d0a3e1 100644 --- a/settings_dev.py +++ b/settings_dev.py @@ -60,10 +60,14 @@ GRACEDB_DATA_DIR = "/mnt/gracedb-web/data" #GRACEDB_DATA_DIR = "/mnt/gracedb-web-temp/data" # Latency histograms. Where they go and max latency to bin. -LATENCY_REPORT_DEST_DIR = "/home/bmoe/django/data/latency" +LATENCY_REPORT_DEST_DIR = "/home/bmoe/data/latency" LATENCY_MAXIMUM_CHARTED = 1800 LATENCY_REPORT_WEB_PAGE_FILE_PATH = LATENCY_REPORT_DEST_DIR + "/latency.inc" +REPORT_CBC_IFAR_QUERY = "LowMass ER1 hasfar" +REPORT_IFAR_IMAGE = LATENCY_REPORT_DEST_DIR + "/ifar.png" +REPORT_IFAR_URL = "ifar.png" + # RSS Feed Defaults FEED_MAX_RESULTS = 50 diff --git a/templates/gracedb/histogram.html b/templates/gracedb/histogram.html index 5419b8f4f..f2fabdb25 100644 --- a/templates/gracedb/histogram.html +++ b/templates/gracedb/histogram.html @@ -1,11 +1,21 @@ {% extends "base.html" %} -{% block title %}Reporting Latency{% endblock %} -{% block heading %}Reporting Latency{% endblock %} +{% block title %}Reports{% endblock %} +{% block heading %}Reports{% endblock %} {% block pageid %}reports{% endblock %} {% block content %} +<h3>Latency</h3> {{ table|safe }} +<br/> + +<h3>CBC IFAR</h3> +{% if ifar %} + <img src="{{ ifar }}">hai +{% else %} + No IFAR table. +{% endif %} + {% endblock %} -- GitLab