@@ -83,6 +83,17 @@ def get_at_most_once_key(namespace: str, taskname: str, task_id: str) -> str:
83
83
return f"tw:amo:{ namespace } :{ taskname } :{ task_id } "
84
84
85
85
86
+ def status_name (status : TaskActivationStatus .ValueType ) -> str :
87
+ """Convert a TaskActivationStatus to a human readable name"""
88
+ if status == TASK_ACTIVATION_STATUS_COMPLETE :
89
+ return "complete"
90
+ if status == TASK_ACTIVATION_STATUS_FAILURE :
91
+ return "failure"
92
+ if status == TASK_ACTIVATION_STATUS_RETRY :
93
+ return "retry"
94
+ return f"unknown-{ status } "
95
+
96
+
86
97
def child_process (
87
98
child_tasks : queue .Queue [TaskActivation ],
88
99
processed_tasks : queue .Queue [ProcessingResult ],
@@ -334,15 +345,15 @@ def record_task_execution(
334
345
"taskname" : activation .taskname ,
335
346
"execution_duration" : execution_duration ,
336
347
"execution_latency" : execution_latency ,
337
- "status" : status ,
348
+ "status" : status_name ( status ) ,
338
349
},
339
350
)
340
351
metrics .incr (
341
352
"taskworker.worker.execute_task" ,
342
353
tags = {
343
354
"namespace" : activation .namespace ,
344
355
"taskname" : activation .taskname ,
345
- "status" : status ,
356
+ "status" : status_name ( status ) ,
346
357
"processing_pool" : processing_pool_name ,
347
358
},
348
359
)
0 commit comments