Bogdanp/dramatiq_dashboard

How to set the name of the worker?

yanxiu0614 opened this issue · 1 comments

Issues

Thank you very much for your work. I am using dramatiq_dashboard,it is very good,but it is very difficult to understand that worker name is a bunch of meaningless letters.

As we know, there will always be an accident. However I don't know what I can do at that time. Can you tell me how to set name of worker and which tasks each worker is running?

Thank you.

This isn't possible right now. One thing we could do in the future is expose an environment variable to help augment this line:

https://github.com/Bogdanp/dramatiq/blob/master/dramatiq/brokers/redis.py#L104

basically, we could turn it into

self.broker_id = getenv("dramatiq_broker_id_prefix", "") + str(uuid4())

or maybe even just

self.broker_id = socket.gethostname() + "_" + str(uuid4())

or some combination of both. If you're willing to make that PR to Dramatiq, I'd happily accept it. Make sure you read the CONTRIBUTING.md document first.