Changes for stability
This commit is contained in:
parent
9b4e5d5c57
commit
19783efd57
2 changed files with 12 additions and 3 deletions
|
@ -84,7 +84,7 @@ class HIT(Base):
|
|||
return "accepted by worker"
|
||||
# on abandon:
|
||||
if self.worker_id:
|
||||
return "abandoned / awaiting worker"
|
||||
return "abandoned by worker"
|
||||
return "awaiting worker"
|
||||
|
||||
|
||||
|
@ -166,7 +166,7 @@ class Store:
|
|||
return self.getAvgDurationOfPreviousNHits(5)
|
||||
|
||||
def getHitTimeout(self):
|
||||
return max(200, self.getAvgDurationOfPreviousNHits(5)*2)
|
||||
return max(160, self.getAvgDurationOfPreviousNHits(5)*2)
|
||||
|
||||
def getHITs(self, n = 100):
|
||||
return self.session.query(HIT).\
|
||||
|
|
|
@ -230,6 +230,7 @@ class CentralManagement():
|
|||
sqsHit.submit_hit_at = datetime.datetime.utcnow() # fake submit
|
||||
if updateStatus:
|
||||
self.setLight(False)
|
||||
self.mturk.create_worker_block(WorkerId=signal.params['event']['WorkerId'], Reason='Accepted task without working on it.')
|
||||
|
||||
elif signal.name == 'sqs.AssignmentReturned':
|
||||
self.logger.info(f'Set status progress to returned')
|
||||
|
@ -251,6 +252,14 @@ class CentralManagement():
|
|||
if sqsHit.uuid not in sqsHit.answer:
|
||||
self.logger.critical(f"Not a valid answer given?! {sqsHit.answer}")
|
||||
|
||||
if not sqsHit.submit_page_at:
|
||||
# page not submitted, hit is. Nevertheless, create new hit.
|
||||
try:
|
||||
self.mturk.reject_assignment(AssignmentId=signal.params['event']['AssignmentId'], RequesterFeedback='Did not do the assignment')
|
||||
except Exception as e:
|
||||
self.logger.exception(e)
|
||||
self.makeHit()
|
||||
else:
|
||||
sqsHit.submit_hit_at = datetime.datetime.strptime(signal.params['event']['EventTimestamp'],"%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
self.store.saveHIT(sqsHit)
|
||||
|
|
Loading…
Reference in a new issue