aboutsummaryrefslogtreecommitdiff
path: root/jb
diff options
context:
space:
mode:
Diffstat (limited to 'jb')
-rw-r--r--jb/flow/tasks.py7
-rw-r--r--jb/managers/hit.py2
-rw-r--r--jb/models/event.py4
-rw-r--r--jb/views/common.py1
4 files changed, 7 insertions, 7 deletions
diff --git a/jb/flow/tasks.py b/jb/flow/tasks.py
index 808c8f7..77825d3 100644
--- a/jb/flow/tasks.py
+++ b/jb/flow/tasks.py
@@ -4,10 +4,9 @@ from typing import TypedDict, cast
from generalresearchutils.config import is_debug
-from jb.decorators import HTM, HM, HQM, pg_config
+from jb.decorators import AMTM, HTM, HM, HQM, pg_config
from jb.flow.maintenance import check_hit_status
from jb.flow.monitoring import write_hit_gauge, emit_hit_event
-from jb.managers.amt import AMTManager
from jb.models.definitions import HitStatus
from jb.models.hit import HitType, HitQuestion, Hit
@@ -37,6 +36,7 @@ def check_stale_hits():
for hit in cast(list[HitRow], res):
logging.info(f"check_stale_hits: {hit["amt_hit_id"]}")
check_hit_status(
+ amtm=AMTM,
amt_hit_id=hit["amt_hit_id"],
amt_hit_type_id=hit["amt_hit_type_id"],
reason="cleanup",
@@ -58,6 +58,7 @@ def check_expired_hits():
for hit in cast(list[HitRow], res):
logging.info(f"check_expired_hits: {hit["amt_hit_id"]}")
check_hit_status(
+ amtm=AMTM,
amt_hit_id=hit["amt_hit_id"],
amt_hit_type_id=hit["amt_hit_type_id"],
reason="expired",
@@ -73,7 +74,7 @@ def create_hit_from_hittype(hit_type: HitType) -> Hit:
HitQuestion(height=800, url="https://jamesbillings67.com/work/")
)
- hit = AMTManager.create_hit_with_hit_type(hit_type=hit_type, question=question)
+ hit = AMTM.create_hit_with_hit_type(hit_type=hit_type, question=question)
HM.create(hit)
emit_hit_event(status=hit.status, amt_hit_type_id=hit.amt_hit_type_id)
return hit
diff --git a/jb/managers/hit.py b/jb/managers/hit.py
index 533f45a..63af2d4 100644
--- a/jb/managers/hit.py
+++ b/jb/managers/hit.py
@@ -338,7 +338,7 @@ class HitManager(PostgresManager):
FROM mtwerk_hit
WHERE status = %(status)s
AND hit_type_id = %(hit_type_id)s;
- """,
+ """,
params={"status": HitStatus.Assignable, "hit_type_id": hit_type_id},
)[0]["active_count"]
diff --git a/jb/models/event.py b/jb/models/event.py
index c167420..f8867c0 100644
--- a/jb/models/event.py
+++ b/jb/models/event.py
@@ -1,4 +1,4 @@
-from typing import Literal, Dict
+from typing import Dict, Any
from mypy_boto3_mturk.literals import EventTypeType
from pydantic import BaseModel, Field
@@ -29,7 +29,7 @@ class MTurkEvent(BaseModel):
)
@classmethod
- def from_sns(cls, data: Dict):
+ def from_sns(cls, data: Dict[str, Any]):
return cls.model_validate(
{
"event_type": data["EventType"],
diff --git a/jb/views/common.py b/jb/views/common.py
index c87b1a5..7011557 100644
--- a/jb/views/common.py
+++ b/jb/views/common.py
@@ -1,5 +1,4 @@
import json
-from unittest import case
from typing import Dict, Any
import requests