closeio / tasktiger

Python task queue using Redis
MIT License
1.42k stars 80 forks source link

add tiger.current_serialized_func #296

Closed nsaje closed 1 year ago

nsaje commented 1 year ago

Adds a current_serialized_func property to the tiger object.

This is useful for instrumentation - the current_serialized_func can be used for naming spans or labeling metrics.

Without it one would have to do e.g.

try:
    return tiger.current_task.serialized_func
except RuntimeError:
    return tiger.current_tasks[0].serialized_func

because we don't expose current_task_is_batch either.