More status page events

This commit is contained in:
Ruben van de Ven 2019-11-01 17:41:16 +01:00
parent 6e4017beee
commit d58abf161f
3 changed files with 6 additions and 0 deletions

View file

@ -153,11 +153,13 @@ class CentralManagement():
self.store.saveHIT(self.currentHit)
self.setLight(True)
self.server.statusPage.set('state', self.currentHit.getStatus())
self.server.statusPage.set('hit_opened', self.currentHit.open_page_at)
elif signal.name == 'server.submit':
self.currentHit.submit_page_at = datetime.datetime.utcnow()
self.store.saveHIT(self.currentHit)
self.plotter.park()
self.server.statusPage.set('state', self.currentHit.getStatus())
self.server.statusPage.set('hit_opened', self.currentHit.open_page_at)
# park always triggers a plotter.finished after being processed
elif signal.name[:4] == 'sqs.':
@ -214,6 +216,7 @@ class CentralManagement():
self.setLight(False)
scan = threading.Thread(target=self.scanImage, name='scan')
scan.start()
self.server.statusPage.set('hit_submitted', self.currentHit.submit_page_at)
else:
self.logger.critical(f"Unknown signal: {signal.name}")
@ -251,6 +254,7 @@ class CentralManagement():
self.store.saveHIT(self.currentHit)
# TODO: have HITStore/HIT take care of this by emitting a signal
self.server.statusPage.set('hit_id', new_hit['HIT']['HITId'])
self.server.statusPage.set('hit_created', self.currentHit.created_at)
# mturk.send_test_event_notification()
if self.config['amazon']['sqs_url']:

View file

@ -66,6 +66,7 @@ class Plotter:
self.ad.moveto(0,0)
self.ad.disconnect()
self.logger.critical("Clear running Event")
# send shutdown signal (if not already set)
self.isRunning.clear()

View file

@ -348,6 +348,7 @@ class StatusPage():
self.fee = None
self.hit_created = None
self.hit_opened = None
self.hit_submitted = None
def __setattr__(self, name, value):
if name in self.__dict__ and self.__dict__[name] == value: