Refactor #3675
Updated by jortel@redhat.com almost 6 years ago
Parsing a _special_ name to determine the role of the PulpWorker can be error prone and lead to failure scenarios that can be difficult to troubleshoot. I ran into this nearly silent failure with the celery code as well and burned a bit of time figuring it out. <pre> rq worker -n 'reserved_resource_worker_1@%h' -w 'pulpcore.tasking.worker.PulpWorker' </pre> Suggest a cleaner, more explicit approach is to create have 2 concrete classes of workers that can determine the _queues_ which are passed to super(). And, perhaps determine its _name_? Eg: <pre> rq worker -w 'pulpcore.tasking.worker.ReservedWorker' rq worker -w 'pulpcore.tasking.worker.ResourceManager' 'pulpcore.tasking.worker.PulpReservedWorker' </pre> Would -n <name> still be needed? Simpler and if the user get's the classpath to the worker wrong, the logged exception will be self explanatory. [1] https://github.com/pulp/pulp/blob/3.0-dev/pulpcore/pulpcore/tasking/worker.py#L56-L57