diff --git a/TODO b/TODO index ecb0254d52b..575e76b5fe8 100644 --- a/TODO +++ b/TODO @@ -30,11 +30,9 @@ Simon + Prüfen, warum in der Map Anzeige manchmal ein Competitor doppelt ist + Wind aus der Map löschen wenn der sich geändert hat + Simulator mit Speed = 1 anschmeissen und dann prüfen was passiert -+ Prüfen warum im live leaderbaord manchmal 4 legs angezeigt werden -+ Prüfen warum der Listener thread manchmal nicht richtig gestoppt wird (disconnect sollte auch thread stoppen) -+ Datenbank nicht einfach so löschen (Wind Positionen) -+ Infinity oder große Werte als Ankerindikatoren erkennen und anzeigen können -+ Anzeige Truebearing bei Wind-Informationen ++ Prüfen warum im live leaderbaord manchmal 4 legs angezeigt werden (max ist 2+1) ++ Prüfen warum der Listener thread manchmal nicht richtig gestoppt wird ++ Infinity oder große Werte als Ankerindikatoren anzeigen im UI + MongoDB als Windsource bei addrace oder addevent einstellbar machen + Anzeigen im Leaderboard ob der Wind up oder down ist (competitor.values wäre ein guter platz dafür) + Implementierung Leaderboard auf Basis HTML Designer diff --git a/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/RaceTrackerImpl.java b/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/RaceTrackerImpl.java index 4dc784b96d0..be6a7ddb11b 100755 --- a/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/RaceTrackerImpl.java +++ b/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/RaceTrackerImpl.java @@ -57,6 +57,13 @@ public class RaceTrackerImpl implements Listener, RaceTracker { throws URISyntaxException, MalformedURLException, FileNotFoundException { // Read event data from configuration file tractracEvent = KeyValue.setup(paramURL); + + // can happen that tractrac event is null (occurs when there is no internet connection) + // so lets raise some meaningful exception + if (tractracEvent == null) { + throw new RuntimeException("Connection failed. Could not connect to " + paramURL); + } + // Initialize data controller using live and stored data sources controller = new DataController(liveURI, storedURI, this); // Start live and stored data streams diff --git a/python/src/sailing.connector/sailing/connector/__init__.py b/python/src/sailing.connector/sailing/connector/__init__.py index a3c45082547..d7f8dcb55b2 100644 --- a/python/src/sailing.connector/sailing/connector/__init__.py +++ b/python/src/sailing.connector/sailing/connector/__init__.py @@ -68,7 +68,7 @@ class URIConfigurator(object): def trigger(self, request=None): if self.do_log is True: log.info('Triggering URI %s' % self.URI()) - return urllib2.urlopen(self.URI()) + return urllib2.urlopen(self.URI()).read() def jsonByUrl(configurator): """ Connects to specified REST service and returns parsed data """ diff --git a/python/src/sailing.db/sailing/db/database.py b/python/src/sailing.db/sailing/db/database.py index 920627f01fd..51a04e91eb9 100644 --- a/python/src/sailing.db/sailing/db/database.py +++ b/python/src/sailing.db/sailing/db/database.py @@ -36,11 +36,11 @@ def setupDatabases(): databases[dbname] = db connections[dbname] = conn - for collection in d['collections']: + for collection in d['collections'][0].strip().split(' '): collections[collection] = mongokit.Collection(db, collection) collection2connection[collection] = conn - LOG.info('Attached collections: %s' % ', '.join(collections)) + LOG.info('Attached collections to database %s: %s' % (dbname, ', '.join(d['collections']))) def getCollection(collection): """ Return a MongoDB collection by its name """ diff --git a/python/src/sailing.db/sailing/db/monitoring.py b/python/src/sailing.db/sailing/db/monitoring.py index c674834bd61..58095813540 100644 --- a/python/src/sailing.db/sailing/db/monitoring.py +++ b/python/src/sailing.db/sailing/db/monitoring.py @@ -1,5 +1,8 @@ from database import databases, collections +import logging +log = logging.getLogger(__name__) + def dbStats(): result = dict() for dbname in databases: diff --git a/python/src/sailing.web/sailing/web/browser/functions.py b/python/src/sailing.web/sailing/web/browser/functions.py index e5f1eb13365..c84138b3811 100644 --- a/python/src/sailing.web/sailing/web/browser/functions.py +++ b/python/src/sailing.web/sailing/web/browser/functions.py @@ -29,7 +29,6 @@ threaded_listener = {} def dropDB(context, request): from sailing.db.monitoring import dropDB dropDB() - return HTTPFound(location='/') def startListenerThreads(conf, eventlist): @@ -55,30 +54,6 @@ def startListenerThreads(conf, eventlist): threaded_listener[key] = t t.start() -# addEvent -def configureListener(context, request): - host = request.POST.get('host', 'localhost') - port = request.POST.get('port', '8888') - - lock = threading.Lock() - - view = core.BaseView(context, request) - - conf = URIConfigurator(host, port) - view.session['listener-conf'] = conf - - if request.POST.get('listener-start', None): - conf.setContext(config.ADMIN) dead threads - lstn = threaded_listener.get(key, None) - if lstn and lstn.running is False and lstn.is_alive() is False: - del threaded_listener[key] - - # now there should be only running threads left - if not threaded_listener.has_key(key): - t = provider.LiveDataReceiver(conf.host, conf.port, event['name'], racename) - threaded_listener[key] = t - t.start() - # addEvent def configureListener(context, request): host = request.POST.get('host', 'localhost') @@ -94,7 +69,6 @@ def configureListener(context, request): if request.POST.get('listener-start', None): conf.setContext(config.ADMIN) - if request.POST.get('eventJSONURL'): conf.setCommand(config.ADD_EVENT) conf.setParameters(dict(eventJSONURL=request.POST.get('eventJSONURL'), @@ -119,6 +93,10 @@ def configureListener(context, request): try: result = conf.trigger() + + if result.find('Exception')>0: + raise Exception, 'Server triggered exception: %s' % result[:550] + except Exception, ex: return view.yieldMessage('Error: %s' % str(ex)) @@ -166,7 +144,6 @@ def configureListener(context, request): if racename: conf.setCommand(config.STOP_RACE) conf.setParameters(dict(eventname=eventname, racename=racename)) - else: conf.setCommand(config.STOP_EVENT) conf.setParameters(dict(eventname=eventname)) @@ -176,8 +153,6 @@ def configureListener(context, request): del view.session['listener-conf'] view.session.save() - # not using get_ident here because we need to be able - # to get a listener by knowing the event and race key = hash('%s-%s-%s-%s' % (conf.host, conf.port, eventname, racename)) if threaded_listener.has_key(key): threaded_listener[key].running = False @@ -194,7 +169,7 @@ def configureListener(context, request): eventlist = provider.eventConfiguration(conf) if model.EventImpl.queryCount() == 0: - return view.yieldMessage('Seems that there are no events that can be shown! Server not started?') + return view.yieldMessage('Seems that there are no events that can be shown! Listener not started?') # start listener thread if this is not yet active startListenerThreads(conf, eventlist) @@ -216,8 +191,7 @@ def configuredListeners(context, request): out = [] for key, listener in threaded_listener.items(): out.append( {'host': listener.host, 'port': listener.port, - 'eventname': listener.eventname, - 'last_update': listener.last_update and listener.last_update.strftime('%d.%m %H:%M:%S') or '-', + 'eventname': listener.eventname, 'last_update': listener.last_update and listener.last_update.strftime('%d.%m %H:%M:%S') or '-', 'paused' : listener.paused, 'running': listener.running, 'id' : key, 'racename': listener.racename} ) @@ -291,7 +265,6 @@ def mapCompetitors(context, request): data = jsonByUrl(conf) - # sort by current ranks (if available) if data.get('ranks'): data = data['ranks'] data.sort(lambda x,y: cmp(x['rank'], y['rank'])) diff --git a/python/src/sailing.web/sailing/web/browser/templates/java-connector.pt b/python/src/sailing.web/sailing/web/browser/templates/java-connector.pt index 9d943663774..a7d04af0d9e 100644 --- a/python/src/sailing.web/sailing/web/browser/templates/java-connector.pt +++ b/python/src/sailing.web/sailing/web/browser/templates/java-connector.pt @@ -53,6 +53,14 @@ When stopping listener it will trigger two methods: If you select a race +
+ Persistent store where to persist wind tracks
+ +
+
  Drop Database before connect
diff --git a/python/src/sailing.web/sailing/web/browser/templates/wind-settings-info.pt b/python/src/sailing.web/sailing/web/browser/templates/wind-settings-info.pt index 8d9c392325d..bb3b7a80673 100644 --- a/python/src/sailing.web/sailing/web/browser/templates/wind-settings-info.pt +++ b/python/src/sailing.web/sailing/web/browser/templates/wind-settings-info.pt @@ -22,7 +22,9 @@ ${view.millisToDatetime(track['timepoint'])}  Bearing: ${track['truebearingdeg']}  + Dampened Bearing: ${track['dampenedtruebearingdeg']}  Speed: ${track['knotspeed']}  + Dampened Speed: ${track['dampenedknotspeed']}  LatDeg: ${track.get('latdeg', 'N/A')}  LngDeg: ${track.get('lngdeg', 'N/A')}
@@ -39,7 +41,9 @@ ${view.millisToDatetime(track['timepoint'])}  Bearing: ${track['truebearingdeg']}  + Dampened Bearing: ${track['dampenedtruebearingdeg']}  Speed: ${track['knotspeed']}  + Dampened Speed: ${track['dampenedknotspeed']}  LatDeg: ${track.get('latdeg', 'N/A')}  LngDeg: ${track.get('lngdeg', 'N/A')}
diff --git a/python/templates/db.ini b/python/templates/db.ini index bc9c0f91737..e48ac879feb 100644 --- a/python/templates/db.ini +++ b/python/templates/db.ini @@ -24,5 +24,5 @@ port = ${conf:mongodb_port} dbname = biography username = password = -collections = competitors +collections = competitor_info