Compare commits

...

2 commits

Author SHA1 Message Date
Ruben van de Ven
ac96bbff64 Merge branch 'master' of git.rubenvandeven.com:r/guest_worker 2020-01-22 19:07:20 +01:00
Ruben van de Ven
cd1ede252f Wip. Fix for unambiguous assignment id 2020-01-22 19:07:07 +01:00
2 changed files with 8 additions and 1 deletions

View file

@ -326,7 +326,8 @@ class CentralManagement():
sqsHit = self.currentHit sqsHit = self.currentHit
updateStatus = True 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: if not sqsAssignment:
self.logger.critical(f"Invalid assignmentId given for hit: {signal.params['event']}") self.logger.critical(f"Invalid assignmentId given for hit: {signal.params['event']}")
continue continue

View file

@ -75,7 +75,10 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
self.hit = self.store.currentHit 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('assignmentId'))
self.assignment_id += '_' + str(self.get_query_argument('workerId'))
self.assignment = self.hit.getLastAssignment() self.assignment = self.hit.getLastAssignment()
if self.assignment.assignment_id != self.assignment_id: if self.assignment.assignment_id != self.assignment_id:
@ -317,6 +320,9 @@ class DrawPageHandler(tornado.web.RequestHandler):
return return
assignmentId = self.get_query_argument('assignmentId', '') assignmentId = self.get_query_argument('assignmentId', '')
if len(assignmentId):
assignmentId += '_' + str(self.get_query_argument('workerId', ''))
if len(assignmentId) < 1: if len(assignmentId) < 1:
logger.critical("Accessing page without assignment id. Allowing it for debug purposes... fingers crossed?") logger.critical("Accessing page without assignment id. Allowing it for debug purposes... fingers crossed?")