Merge branch 'master' of ssh://localhost:12347/home/trac/git

This commit is contained in:
Axel Uhl committed 2011-06-10 23:27:03 +02:00
commit 72aedaea6f
9 files changed
+35 -42

No files matched your search

+3 -5
View File
@@ -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
@@ -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
@@ -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 """
+2 -2
View File
@@ -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 """
@@ -1,5 +1,8 @@
from database import databases, collections
import logging
log = logging.getLogger(__name__)
def dbStats():
result = dict()
for dbname in databases:
@@ -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']))
@@ -53,6 +53,14 @@ When <i>stopping listener</i> it will trigger two methods: If you select a race
</select>
</div>
<div class="field">
<span>Persistent store where to persist wind tracks</span><br/>
<select name="windstore">
<option value="empty">Do not persist wind</option>
<option value="mongo">MongoDB Persister</option>
</select>
</div>
<div class="field">
<input type="checkbox" name="drop_db" />&nbsp;
<span>Drop Database before connect</span><br/>
@@ -22,7 +22,9 @@
<tal:for repeat="track wind['EXPEDITION'][:10]">
<b>${view.millisToDatetime(track['timepoint'])}</b>&nbsp;
Bearing: ${track['truebearingdeg']}&nbsp;
Dampened Bearing: ${track['dampenedtruebearingdeg']}&nbsp;
Speed: ${track['knotspeed']}&nbsp;
Dampened Speed: ${track['dampenedknotspeed']}&nbsp;
LatDeg: ${track.get('latdeg', 'N/A')}&nbsp;
LngDeg: ${track.get('lngdeg', 'N/A')}<br/>
</tal:for>
@@ -39,7 +41,9 @@
<tal:for repeat="track wind['WEB'][:10]">
<b>${view.millisToDatetime(track['timepoint'])}</b>&nbsp;
Bearing: ${track['truebearingdeg']}&nbsp;
Dampened Bearing: ${track['dampenedtruebearingdeg']}&nbsp;
Speed: ${track['knotspeed']}&nbsp;
Dampened Speed: ${track['dampenedknotspeed']}&nbsp;
LatDeg: ${track.get('latdeg', 'N/A')}&nbsp;
LngDeg: ${track.get('lngdeg', 'N/A')}<br/>
</tal:for>
+1 -1
View File
@@ -24,5 +24,5 @@ port = ${conf:mongodb_port}
dbname = biography
username =
password =
collections = competitors
collections = competitor_info