Project

Profile

Help

Refactor #3675

closed

Using special name to determine RQ worker role can be problematic.

Added by jortel@redhat.com almost 6 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

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.

rq worker -n 'reserved_resource_worker_1@%h' -w 'pulpcore.tasking.worker.PulpWorker'

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:

rq worker -w 'pulpcore.tasking.worker.ReservedWorker'
rq worker -w 'pulpcore.tasking.worker.ResourceManager'

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

Also available in: Atom PDF