Add rq.runtime for information from workers/queues #1775
Replies: 3 comments 3 replies
-
Moving this to a discussion since it's pretty rough around the edges still, and this topic hasn't been alive for quite a while now. -- For the record and eventual discussions in the future, personally I find that this design in which there an extra (very specific) functional class can be troublesome and confusing. What I prefer, is to have a singleton-like entrypoint, and managing things from there. rq = RQ(connection=Redis())
rq.get_workers()
rq.get_queues()
rq.get_jobs()
rq.enqueue('low', task) # avoids having to import multiple queues This centralizes the management tasks into a single place, is a single import, single Redis connection to pass around and a lot easier to use IMO. I actually implement this in my projects, so I would be happy to work on that @selwin |
Beta Was this translation helpful? Give feedback.
-
I like the idea of having an RQ entry point. However, I think we'll still need classes such as rq = RQ(connection=Redis())
queue = rq.get_queue('low')
worker = rq.get_worker('default') |
Beta Was this translation helpful? Give feedback.
-
Having a better CLI interface to get runtime information is also something that I'd like to have. Perhaps we can build a separate |
Beta Was this translation helpful? Give feedback.
-
Follow up on #517
Comment from @nvie
Below a draft of what the API could look like. Contributions are greatly appreciated ;-) @nvie @selwin
API (draft)
rq.Runtime(redis)
rq.Runtime.get_workers()
rq.WorkerInfo
rq.QueueInfo
rq.QueueInfo.get_jobs()
Beta Was this translation helpful? Give feedback.
All reactions