diff options
| author | Max Nanis | 2026-02-19 20:11:41 -0500 |
|---|---|---|
| committer | Max Nanis | 2026-02-19 20:11:41 -0500 |
| commit | 8b31678c6e44400967d4934cd9f3c6c6ac0da721 (patch) | |
| tree | 41c5f4479c353a16da1a8b6fa9088abd084ea388 /jb/flow/maintenance.py | |
| parent | f0f96f83c2630e890a2cbcab53f77fd4c37e1684 (diff) | |
| download | amt-jb-8b31678c6e44400967d4934cd9f3c6c6ac0da721.tar.gz amt-jb-8b31678c6e44400967d4934cd9f3c6c6ac0da721.zip | |
Carer dir into project, some initial pytest, part of the flow tasks. License and Readme update
Diffstat (limited to 'jb/flow/maintenance.py')
| -rw-r--r-- | jb/flow/maintenance.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/jb/flow/maintenance.py b/jb/flow/maintenance.py new file mode 100644 index 0000000..5dc9cea --- /dev/null +++ b/jb/flow/maintenance.py @@ -0,0 +1,26 @@ +from typing import Optional + +from jb.decorators import HM +from jb.flow.monitoring import emit_hit_event +from jb.managers.amt import AMTManager +from jb.models.definitions import HitStatus + + +def check_hit_status( + amt_hit_id: str, amt_hit_type_id: str, reason: Optional[str] = None +) -> HitStatus: + """ + (this used to be called "process_hit") + Request information from Amazon regarding the status of a HIT ID. Update the local state from + that response. + """ + hit_status = AMTManager.get_hit_status(amt_hit_id=amt_hit_id) + # We're assuming that in the db this Hit is marked as Assignable, or else we wouldn't + # have called this function. + if hit_status != HitStatus.Assignable: + # todo: should update also assignment_pending_count, assignment_available_count, assignment_completed_count + HM.update_status(amt_hit_id=amt_hit_id, hit_status=hit_status) + emit_hit_event( + status=hit_status, amt_hit_type_id=amt_hit_type_id, reason=reason + ) + return hit_status |
