/api/debug/running has audiogens

Šī revīzija ir iekļauta:
boyska 2015-02-01 00:08:56 +01:00
vecāks 24cda62c5f
revīzija 785a2c78fe
Šim parakstam datu bāzē netika atrasta zināma atslēga
GPG atslēgas ID: 7395DCAE58289CA9
2 mainīti faili ar 23 papildinājumiem un 2 dzēšanām

Parādīt failu

@ -106,7 +106,12 @@ class Monitor(ParentedLet):
audiogen = gevent.spawn_later(delta.total_seconds(), audiogenerate, audiogen = gevent.spawn_later(delta.total_seconds(), audiogenerate,
audiospec) audiospec)
self.running[timespec.eid] = audiogen self.running[timespec.eid] = {
'greenlet': audiogen,
'running_time': datetime.now() + timedelta(
seconds=delta.total_seconds()),
'audiospec': audiospec
}
gevent.spawn_later(delta.total_seconds(), gevent.spawn_later(delta.total_seconds(),
self.source.reload_id, self.source.reload_id,
timespec.eid) timespec.eid)

Parādīt failu

@ -34,6 +34,20 @@ def rpc_refresh():
return jsonify(dict(status='ok')) return jsonify(dict(status='ok'))
def get_scheduled_audiogen():
larigira = current_app.larigira
model = larigira.monitor.source.model
running = larigira.monitor.running
events = {t: {} for t in running.keys()}
for timespec_eid in events:
orig_info = running[timespec_eid]
info = events[timespec_eid]
info['running_time'] = orig_info['running_time'].isoformat()
info['audiospec'] = orig_info['audiospec']
info['timespec'] = model.get_alarm_by_id(timespec_eid)
return events
@rpc.route('/debug/running') @rpc.route('/debug/running')
def rpc_wip(): def rpc_wip():
greenlets = [] greenlets = []
@ -44,7 +58,9 @@ def rpc_wip():
'class': ob.__class__.__name__, 'class': ob.__class__.__name__,
'parent': repr(ob.parent) 'parent': repr(ob.parent)
}) })
return jsonify(dict(greenlets=greenlets)) return jsonify(dict(greenlets=greenlets,
audiogens=get_scheduled_audiogen(),
))
def create_app(queue, larigira): def create_app(queue, larigira):