Wip. Fix for unambiguous assignment id

This commit is contained in:
Ruben van de Ven 2020-01-22 19:07:07 +01:00
parent 74f6ff55a3
commit cd1ede252f
2 changed files with 8 additions and 1 deletions

View file

@ -326,7 +326,8 @@ class CentralManagement():
sqsHit = self.currentHit
updateStatus = True
sqsAssignment = sqsHit.getAssignmentById(signal.params['event']['AssignmentId'])
assId = signal.params['event']['AssignmentId'] + '_' + signal.params['event']['WorkerId']
sqsAssignment = sqsHit.getAssignmentById(assId)
if not sqsAssignment:
self.logger.critical(f"Invalid assignmentId given for hit: {signal.params['event']}")
continue

View file

@ -75,7 +75,10 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
self.hit = self.store.currentHit
# my core assumption about assignment_id was wrong. It is not unique per worker, so we need to merge those
self.assignment_id = str(self.get_query_argument('assignmentId'))
self.assignment_id += '_' + str(self.get_query_argument('workerId'))
self.assignment = self.hit.getLastAssignment()
if self.assignment.assignment_id != self.assignment_id:
@ -317,6 +320,9 @@ class DrawPageHandler(tornado.web.RequestHandler):
return
assignmentId = self.get_query_argument('assignmentId', '')
if len(assignmentId):
assignmentId += '_' + str(self.get_query_argument('workerId', ''))
if len(assignmentId) < 1:
logger.critical("Accessing page without assignment id. Allowing it for debug purposes... fingers crossed?")