aboutsummaryrefslogtreecommitdiff
path: root/jb/flow/monitoring.py
diff options
context:
space:
mode:
Diffstat (limited to 'jb/flow/monitoring.py')
-rw-r--r--jb/flow/monitoring.py23
1 files changed, 4 insertions, 19 deletions
diff --git a/jb/flow/monitoring.py b/jb/flow/monitoring.py
index 334eab3..22e9e93 100644
--- a/jb/flow/monitoring.py
+++ b/jb/flow/monitoring.py
@@ -1,12 +1,11 @@
import socket
-from typing import Optional
+from generalresearch.currency import USDCent
from mypy_boto3_mturk.literals import EventTypeType
from jb.config import settings
from jb.decorators import influx_client
-from generalresearch.currency import USDCent
-from jb.models.definitions import HitStatus, AssignmentStatus
+from jb.models.definitions import AssignmentStatus, HitStatus
def write_hit_gauge(status: HitStatus, amt_hit_type_id: str, cnt: int) -> None:
@@ -26,8 +25,6 @@ def write_hit_gauge(status: HitStatus, amt_hit_type_id: str, cnt: int) -> None:
if influx_client:
influx_client.write_points(points=[point])
- return None
-
def write_assignment_gauge(
status: AssignmentStatus, amt_hit_type_id: str, cnt: int
@@ -47,11 +44,9 @@ def write_assignment_gauge(
if influx_client:
influx_client.write_points(points=[point])
- return None
-
def emit_hit_event(
- status: HitStatus, amt_hit_type_id: str, reason: Optional[str] = None
+ status: HitStatus, amt_hit_type_id: str, reason: str | None = None
) -> None:
"""
e.g. a HIT was created, Reviewable, etc. We don't have a "created"
@@ -77,11 +72,9 @@ def emit_hit_event(
if influx_client:
influx_client.write_points([point])
- return None
-
def emit_assignment_event(
- status: AssignmentStatus, amt_hit_type_id: str, reason: Optional[str] = None
+ status: AssignmentStatus, amt_hit_type_id: str, reason: str | None = None
) -> None:
"""
e.g. an Assignment was accepted/approved/reject
@@ -106,8 +99,6 @@ def emit_assignment_event(
if influx_client:
influx_client.write_points([point])
- return None
-
def emit_mturk_notification_event(
event_type: EventTypeType, amt_hit_type_id: str
@@ -133,8 +124,6 @@ def emit_mturk_notification_event(
if influx_client:
influx_client.write_points([point])
- return None
-
def emit_error_event(event_type: str, amt_hit_type_id: str) -> None:
"""
@@ -157,8 +146,6 @@ def emit_error_event(event_type: str, amt_hit_type_id: str) -> None:
if influx_client:
influx_client.write_points([point])
- return None
-
def emit_bonus_event(amount: USDCent, amt_hit_type_id: str) -> None:
"""
@@ -179,5 +166,3 @@ def emit_bonus_event(amount: USDCent, amt_hit_type_id: str) -> None:
if influx_client:
influx_client.write_points([point])
-
- return None