diff --git a/gracedb/buildVOEvent.py b/gracedb/buildVOEvent.py index 0631bbf4e8e4d36d35a16c859cd0e5fe3c75a9f7..0954aba317adbbe208f32b43e6f2177ec729f698 100755 --- a/gracedb/buildVOEvent.py +++ b/gracedb/buildVOEvent.py @@ -118,19 +118,19 @@ def buildVOEvent(gevent, request=None, description=None, role=None): shib_fits_skymap_url = request.build_absolute_uri(shib_fits_skymap_url) shib_png_skymap_url = request.build_absolute_uri(shib_png_skymap_url) - p = Param(name="skymap", ucd="meta.ref.url", value=x509_png_skymap_url) + p = Param(name="skymap_png_x509", ucd="meta.ref.url", value=x509_png_skymap_url) p.set_Description(["Sky Map image X509 protected"]) w.add_Param(p) - p = Param(name="skymap", ucd="meta.ref.url", value=x509_fits_skymap_url) + p = Param(name="skymap_fits_x509", ucd="meta.ref.url", value=x509_fits_skymap_url) p.set_Description(["Sky Map FITS X509 protected"]) w.add_Param(p) - p = Param(name="skymap", ucd="meta.ref.url", value=shib_png_skymap_url) + p = Param(name="skymap_png_shib", ucd="meta.ref.url", value=shib_png_skymap_url) p.set_Description(["Sky Map image Shibboleth protected"]) w.add_Param(p) - p = Param(name="skymap", ucd="meta.ref.url", value=shib_fits_skymap_url) + p = Param(name="skymap_fits_shib", ucd="meta.ref.url", value=shib_fits_skymap_url) p.set_Description(["Sky Map FITS Shibboleth protected"]) w.add_Param(p) @@ -178,6 +178,7 @@ def submitToSkyalert(gevent, validate_only=False): # the server that will handle the submit request url = "http://skyalert.org/submit/" url = "https://betelgeuse.ligo.caltech.edu:8000/submit/" + url = "http://betelgeuse.ligo.caltech.edu/submit/" # choose 'dryrun' for validation and 'author' for authoring dict['checker'] = 'dryrun' @@ -190,11 +191,11 @@ def submitToSkyalert(gevent, validate_only=False): dict['checker'] = 'author' # Skyalert username and password - dict['username'] = 'brian' - dict['password'] = 'man8men.' + dict['username'] = 'system' + dict['password'] = 'OPV537' # This is the short name for the stream, must match credentials and event! - dict['streamName'] = 'gracedb' + dict['streamName'] = 'LIGO' # Should alerts be run once the event is ingested? dict['doRules'] = 'on' diff --git a/gracedb/query.py b/gracedb/query.py index b9417498c04dbc231582dfa83bd8aad0e4da5102..65dfaed1182928d5fafe0e30425098d88154bee3 100644 --- a/gracedb/query.py +++ b/gracedb/query.py @@ -63,8 +63,9 @@ gpsQ = gpsQ.setParseAction(maybeRange("gpstime")) # run ids runmap = { #"ER2" : (1026061216, 1028480416), - "ER2" : (1026069984, 1028480416), - "ER1" : (1010880015, 1100000000), + #"ER2" : (1026069984, 1028480416), # soft start + "ER2" : (1026666016, 1028480416), # Jul 18 17:00:00 GMT 2012 - Aug 8 17:00:00 GMT 2012 + "ER1" : (1010880015, 1100000000), # End time is very wrong. "S6" : (931035296, 971622087), "S6A" : (931035296, 935798487), "S6B" : (937800015, 947260815), diff --git a/gracedb/translator.py b/gracedb/translator.py index e74a232b165e16dec443e5453cb5ed0e1dd3b47c..6bb0582851dcd9ea25d071d18c3eaf5b0614f958 100644 --- a/gracedb/translator.py +++ b/gracedb/translator.py @@ -341,7 +341,7 @@ class Translator(object): def logData(self): data = self.getData() logdata = [] - logdata.append("Event Type: %s", self.event_type) + logdata.append("Event Type: %s" % self.event_type) logdata.append("Time: %s" % data.get('gpstime', '---')) logdata.append("Duration: %s" % data['rawdata'].get('duration',["---"])[0]) logdata.append("Frequency: %s" % data['rawdata'].get('frequency',["---"])[0]) @@ -397,8 +397,18 @@ class CwbData(Translator): # ... # keyN: value value* # piles of other data not containing ':' + # ... + # more data we don't care about here + # ... + # #significance based on the last 24*6 processed jobs, 4000-1 time shifts + # 318 1.98515e-05 1026099328 1026503796 53644 + # ... + # + # The 2nd number following the "24*6" line is FAR. + # rawdata = {} + # Get Key/Value info for line in datafile: line = line.split(':',1) if len(line) == 1: @@ -406,6 +416,22 @@ class CwbData(Translator): key, val = line rawdata[key] = val.split() + # scan down for FAR + next_line_is_far = False + for line in datafile: + if line.startswith("#significance based on the last 24*6"): + next_line_is_far = True + break + if next_line_is_far: + # Can't just do datafile.readline() -- Python objects. + for line in datafile: + try: + rawdata['far'] = [float(line.split()[1])] + except Exception, e: + # whatever. + pass + break + data = {} data['rawdata'] = rawdata data['gpstime'] = rawdata.get('time',[None])[0] diff --git a/gracedb/views.py b/gracedb/views.py index 2de2e2d5bdccdfa57facc7e8b2a327c10d7bc503..4df0370776d72c7735a0115e1cc5d74c0dbf0d05 100644 --- a/gracedb/views.py +++ b/gracedb/views.py @@ -72,6 +72,10 @@ def skyalert(request, graceid): request.session['flash_msg'] = "No GPS time. Event not suitable for submission to SkyAlert" return HttpResponseRedirect(reverse(view, args=[graceid])) + if not event.far: + request.session['flash_msg'] = "No FAR. Event not suitable for submission to SkyAlert" + return HttpResponseRedirect(reverse(view, args=[graceid])) + if not skyalert_authorized(request): request.session['flash_msg'] = "You are not authorized for SkyAlert submission" return HttpResponseRedirect(reverse(view, args=[graceid])) @@ -83,21 +87,25 @@ def skyalert(request, graceid): skyalert_response = "" # XXX umm. don't we want to know if this email fails silently? mail_admins("SkyAlert Submission Error", - "Event: %s\nExcption: %s\n" % (graceid, e), + "Event: %s\nException: %s\n" % (graceid, e), fail_silently=True) + flashmessage = None if skyalert_response.find("Success") >= 0: - urlpat = re.compile('https://[^ ]*') + urlpat = re.compile('https?://[^ ]*') match = urlpat.search(skyalert_response) if match: message = "Submitted to Skyalert: %s" % match.group() + url = match.group() + flashmessage = 'Submitted to Skyalert: %s' % url + message = 'Submitted to Skyalert: <a href="%s">%s</a>' % (url,url) else: message = "SkyAlert submission problem. Cannot parse SkyAlert response." # XXX umm. don't we want to know if this email fails silently? mail_admins("SkyAlert response parsing problem", "Event: %s\nSkyAlert Response: %s\n" % (graceid, skyalert_response), fail_silently=True) - elif skyalert_response.find('already') >= 0: + elif (skyalert_response.find('already') >= 0) or (skyalert_response.find('Duplicate') >= 0): message = "Event already submitted to SkyAlert" createLogEntry = False elif skyalert_response: @@ -106,7 +114,7 @@ def skyalert(request, graceid): "Event: %s\nSkyAlert Response: %s\n" % (graceid, skyalert_response), fail_silently=True) - request.session['flash_msg'] = message + request.session['flash_msg'] = flashmessage or message if createLogEntry: logentry = EventLog(event=event, issuer=request.ligouser, comment=message) @@ -1004,8 +1012,10 @@ def latest(request): else: form = SimpleSearchForm(request.POST) + template = 'gracedb/latest.html' if not request.ligouser: limit = LimitedEvent + template = 'gracedb/latest_public.html' else: limit = lambda x: x @@ -1021,7 +1031,7 @@ def latest(request): context['error'] = True return render_to_response( - 'gracedb/latest.html', + template, context, context_instance=RequestContext(request)) diff --git a/settings/__init__.py b/settings/__init__.py index cd8199ef53f0b8757be74d1c414cb4e627ec0b26..0fcaf82e26ad5e2d845764e94a897f890b3fd582 100644 --- a/settings/__init__.py +++ b/settings/__init__.py @@ -25,6 +25,10 @@ configs = { '/home/gracedb/gracedb': 'production', '/home/gracedb/graceproj': 'production', + + '/home/branson/gracedbdev': 'branson', + '/home/branson/gracedbdev/gracedb': 'branson', + } diff --git a/settings/branson.py b/settings/branson.py new file mode 100644 index 0000000000000000000000000000000000000000..dbe5521223275f9e62753a6995ad393c5f7aced7 --- /dev/null +++ b/settings/branson.py @@ -0,0 +1,54 @@ + +CONFIG_NAME = "Branson" + +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +DATABASES = { + 'default' : { + 'NAME' : 'branson', + 'ENGINE' : 'django.db.backends.mysql', + 'USER' : 'gracedb', + 'PASSWORD' : 'thinglet', + } +} + + +ALERT_EMAIL_FROM = "Dev Alert <root@moe.phys.uwm.edu>" +ALERT_EMAIL_TO = [ + "Branson Stephens <branson@gravity.phys.uwm.edu>", + ] +ALERT_EMAIL_BCC = ["branson@gravity.phys.uwm.edu"] + +ALERT_TEST_EMAIL_FROM = "Dev Test Alert <root@moe.phys.uwm.edu>" +ALERT_TEST_EMAIL_TO = [ + "Branson Stephens <branson@gravity.phys.uwm.edu>", + ] + +# Don't sent out non-test XMPP alerts on dev box! +XMPP_ALERT_CHANNELS = [ + 'test_omega', + 'test_mbtaonline', + 'test_cwb', + 'test_lowmass', + ] + +# SkyAlert +SKYALERT_IVORN_PATTERN = "ivo://ligo.org/gracedb#%s-dev" + +# Latency histograms. Where they go and max latency to bin. +LATENCY_REPORT_DEST_DIR = "/home/branson/data/latency" +LATENCY_REPORT_WEB_PAGE_FILE_PATH = LATENCY_REPORT_DEST_DIR + "/latency.inc" + +# Uptime reporting +UPTIME_REPORT_DIR = "/homebransonbmoe/data/uptime" + + +SITE_ID = 4 + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + "/homebransonbmoe/gracedb/templates", +) diff --git a/settings/default.py b/settings/default.py index 140960ed14d057b8958298fc11ac6c660693d88b..0a03ec5651effefd00ec73332e6de30fd8573b0a 100644 --- a/settings/default.py +++ b/settings/default.py @@ -14,7 +14,7 @@ MANAGERS = ADMINS ALERT_EMAIL_FROM = "GraCEDb <gracedb@archie.phys.uwm.edu>" ALERT_EMAIL_TO = [ - "gracedb@listserv.ligo.org", +# "gracedb@listserv.ligo.org", ] ALERT_EMAIL_BCC = [ ] @@ -32,6 +32,8 @@ XMPP_ALERT_CHANNELS = [ 'test_cwb', 'cbc_lowmass', 'test_lowmass', + 'cbc_highmass', + 'test_highmass', 'test_grb', ] diff --git a/templates/gracedb/latest_public.html b/templates/gracedb/latest_public.html new file mode 100644 index 0000000000000000000000000000000000000000..59184781d007f2014cdf33decdd50c69f1d37455 --- /dev/null +++ b/templates/gracedb/latest_public.html @@ -0,0 +1,142 @@ +{% extends "base.html" %} + +{% load timeutil %} +{% load scientific %} + +{% block title %}Latest{% endblock %} +{% block heading %}Latest — as of {% now "j F Y H:i T" %}{% endblock %} +{% block pageid %}latest{% endblock %} + + +{% block jscript %} + +{% if not error %} + <meta http-equiv="refresh" content="300;url={% url latest %}/?query={{rawquery|urlencode}}"> +{% endif %} + + {# http/https depending on this pages' protocol #} + <script src="http{% if request.is_secure %}s{% endif %}://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.js" type="text/javascript"></script> + <script type="text/javascript"> + dojo.require("dojox.image.LightboxNano"); + dojo.require("dojo.parser"); + dojo.ready(function(){ + dojo.parser.parse(); + }); + </script> + <style> + a:hover .dojoxEnlarge { + display: block !important; + } + .dojoxEnlarge { + /* background: url(images/enlarge.png) no-repeat 0 0; */ + top: -5px; + left: -5px; + margin: 0 !important; + width: 16px; + height: 16px; + } + .dojoxLoading { + /* background: #333 url(images/loading-dark.gif) no-repeat center center; */ + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border: 2px solid #000; + height: 24px; + opacity: 0.8; + filter: alpha(opacity=80); + padding: 6px; + width: 24px; + } + </style> + + <style> + .summary .graceid { + border-top: 1px solid #CBC9C7; + width: 100%; + font-size: 150%; + font-family: "Century Schoolbook L", "Georgia", serif; + font-weight: 700; + padding-top: 10px; + padding-bottom: 10px; + } + .summary .labels { + padding-bottom: 5px; + padding-left: 5px; + } + .summary .group { + font-weight: 500; + padding-top: 5px; + padding-bottom: 5px; + } + .summary { + clear: both; + padding: 20px; + } + .summary .skymap { + float: right; + } + .summary-data { + } + .timeselect form { + display: inline; + } + </style> + +{% endblock %} + + +{% block content %} + +<form method="POST"> + <table> + {{ form.as_table }} + </table> +</form> + + +{% if objects %} +<table class="event"> + <tr> + <th>Instruments</th> + <th> + {{ "gps"|timeselect:"gps" }} + Event Time + </th> + <th>FAR (Hz)</th> + <th>Latency (sec)</th> + <th> + {{"created"|timeselect:"utc" }} + Created + </th> + <th></th> + </tr> + +{% for object in objects %} + <tr class={% cycle 'odd' 'even' %}> + <td>{{ object.instruments }}</td> + <td>{% if object.gpstime%} + <!-- <span title="{{ object.gpstime|gpsdate }}">{{ object.gpstime }}</span> --> + {{ object.gpstime|multiTime:"gps" }} + {% endif %}</td> + <td>{{ object.far|scientific }}</td> + <td style="text-align:center">{{ object.reportingLatency }}</td> + <td>{{ object.created|multiTime:"created" }}</td> + <td> + {% for log in object.eventlog_set.iterator %} + {% if log.hasImage %} + <div class="skymap"> + <a href="{{ log.fileurl }}" dojoType="dojox.image.LightboxNano"><img height="50" src="{{ log.fileurl }}"></a> + </div> + {% endif %} + {% endfor %} + </td> + </tr> + +{% endfor %} +</table> + +{% else %} <!-- !objects --> +<h1>No events.</h1> +{% endif %} <!-- if objects --> + +{% endblock %}