Does Dramatiq offer a way to get some sort of a human-readable name of the worker within the @dramatiq.actor
function? I would use this to separate log lines from different works.
For example, something like dramatiq-process-1-worker-3
.
@dramatiq.actor(broker=redis_broker, store_results=True, result_ttl=10*1000)
def ping():
# Log worker name here
CurrentMessage
middllwarefrom dramatiq.middleware import CurrentMessage
@dramatiq.actor(broker=redis_broker, store_results=True, result_ttl=10*1000)
def ping():
msg = CurrentMessage.get_current_message()
print(msg.actor_name)