Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
A combination of two bugs was leading to improper outcomes when expiring a task with
Ctrl-C
. First,MTurkUnit
wasn't properly updating from theCREATED
status to theASSIGNED
status unless a db status load occurred elsewhere. The second issue was that moving fromASSIGNED
toEXPIRED
didn't trigger the same return event that it did when moving fromASSIGNED
toLAUNCHED
, preventing running assignments from marking and exiting properly. The combination of these two bugs led to some completed tasks being locally marked as expired, and preventing some workers from being able to submit complete work after aCtrl-C
was triggered.Resolution
To resolve the lack of
CREATED
state change,MTurkUnit
'sget_status
method now calls the super method in when currently inCREATED
, forcing that refresh using the base logic.For triggering a
RETURNED
event, the logic for this is extended to include the transition fromASSIGNED
toEXPIRED
, however the new transition should still set the unit's db status (rather than deferring to the blueprint to decide whether to expire or make available again) as we know the outcome isEXPIRED
.Testing
Launched tasks in MTurk sandbox, noted I could now get a proper return event after expiring hits, and could properly exit on a double-return event. Unit tests still passing