More status page events
This commit is contained in:
parent
6e4017beee
commit
d58abf161f
3 changed files with 6 additions and 0 deletions
|
@ -153,11 +153,13 @@ class CentralManagement():
|
||||||
self.store.saveHIT(self.currentHit)
|
self.store.saveHIT(self.currentHit)
|
||||||
self.setLight(True)
|
self.setLight(True)
|
||||||
self.server.statusPage.set('state', self.currentHit.getStatus())
|
self.server.statusPage.set('state', self.currentHit.getStatus())
|
||||||
|
self.server.statusPage.set('hit_opened', self.currentHit.open_page_at)
|
||||||
elif signal.name == 'server.submit':
|
elif signal.name == 'server.submit':
|
||||||
self.currentHit.submit_page_at = datetime.datetime.utcnow()
|
self.currentHit.submit_page_at = datetime.datetime.utcnow()
|
||||||
self.store.saveHIT(self.currentHit)
|
self.store.saveHIT(self.currentHit)
|
||||||
self.plotter.park()
|
self.plotter.park()
|
||||||
self.server.statusPage.set('state', self.currentHit.getStatus())
|
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
|
# park always triggers a plotter.finished after being processed
|
||||||
|
|
||||||
elif signal.name[:4] == 'sqs.':
|
elif signal.name[:4] == 'sqs.':
|
||||||
|
@ -214,6 +216,7 @@ class CentralManagement():
|
||||||
self.setLight(False)
|
self.setLight(False)
|
||||||
scan = threading.Thread(target=self.scanImage, name='scan')
|
scan = threading.Thread(target=self.scanImage, name='scan')
|
||||||
scan.start()
|
scan.start()
|
||||||
|
self.server.statusPage.set('hit_submitted', self.currentHit.submit_page_at)
|
||||||
else:
|
else:
|
||||||
self.logger.critical(f"Unknown signal: {signal.name}")
|
self.logger.critical(f"Unknown signal: {signal.name}")
|
||||||
|
|
||||||
|
@ -251,6 +254,7 @@ class CentralManagement():
|
||||||
self.store.saveHIT(self.currentHit)
|
self.store.saveHIT(self.currentHit)
|
||||||
# TODO: have HITStore/HIT take care of this by emitting a signal
|
# 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_id', new_hit['HIT']['HITId'])
|
||||||
|
self.server.statusPage.set('hit_created', self.currentHit.created_at)
|
||||||
|
|
||||||
# mturk.send_test_event_notification()
|
# mturk.send_test_event_notification()
|
||||||
if self.config['amazon']['sqs_url']:
|
if self.config['amazon']['sqs_url']:
|
||||||
|
|
|
@ -66,6 +66,7 @@ class Plotter:
|
||||||
self.ad.moveto(0,0)
|
self.ad.moveto(0,0)
|
||||||
self.ad.disconnect()
|
self.ad.disconnect()
|
||||||
|
|
||||||
|
self.logger.critical("Clear running Event")
|
||||||
# send shutdown signal (if not already set)
|
# send shutdown signal (if not already set)
|
||||||
self.isRunning.clear()
|
self.isRunning.clear()
|
||||||
|
|
||||||
|
|
|
@ -348,6 +348,7 @@ class StatusPage():
|
||||||
self.fee = None
|
self.fee = None
|
||||||
self.hit_created = None
|
self.hit_created = None
|
||||||
self.hit_opened = None
|
self.hit_opened = None
|
||||||
|
self.hit_submitted = None
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
def __setattr__(self, name, value):
|
||||||
if name in self.__dict__ and self.__dict__[name] == value:
|
if name in self.__dict__ and self.__dict__[name] == value:
|
||||||
|
|
Loading…
Reference in a new issue