Questions tagged [python-rq]

RQ is a simple, lightweight, Python library for creating background jobs, and processing them.

RQ (Redis Queue) is a simple library for queueing jobs and processing them in the background with workers. It is backed by and it is designed to have a low barrier to entry. It should be integrated in your web stack easily.

Resources

171 questions
126
votes
2 answers

Pros and cons to use Celery vs. RQ

Currently I'm working on python project that requires implement some background jobs (mostly for email sending and heavily database updates). I use Redis for task broker. So in this point I have two candidates: Celery and RQ. I had some experience…
Max Kamenkov
  • 2,478
  • 3
  • 22
  • 19
30
votes
2 answers

Interact with celery ongoing task

We have a distributed architecture based on rabbitMQ and Celery. We can launch in parallel multiple tasks without any issue. The scalability is good. Now we need to control the task remotely: PAUSE, RESUME, CANCEL. The only solution we found is to…
Julio
  • 2,493
  • 4
  • 33
  • 53
24
votes
2 answers

Python Reddis Queue ValueError: Functions from the __main__ module cannot be processed by workers

I'm trying to enqueue a basic job in redis using python-rq, But it throws this error "ValueError: Functions from the main module cannot be processed by workers" Here is my program: import requests def count_words_at_url(url): resp =…
user3258973
  • 241
  • 2
  • 4
19
votes
8 answers

RQ - Empty & Delete Queues

I'm using RQ, and I have a failed queue with thousands of items, and another test queue I created a while back for testing which is now empty and unused. I'm wondering how to remove all jobs from the failed queue, and delete the test queue…
Cian
  • 1,579
  • 3
  • 14
  • 28
17
votes
2 answers

Python Redis Queue (rq) - how to avoid preloading ML model for each job?

I want to queue my ml predictions using rq. Example code (pesudo-ish): predict.py: import tensorflow as tf def predict_stuff(foo): model = tf.load_model() result = model.predict(foo) return result app.py: from rq import Queue from…
Vilmar
  • 408
  • 3
  • 16
15
votes
3 answers

How to create multiple workers in Python-RQ?

We have recently forced to replace celery with RQ as it is simpler and celery was giving us too many problems. Now, we are not able to find a way to create multiple queues dynamically because we need to get multiple jobs done concurrently. So…
RazorHead
  • 1,460
  • 3
  • 14
  • 20
15
votes
8 answers

Best practice of testing django-rq ( python-rq ) in Django

I'll start using django-rq in my project. Django integration with RQ, a Redis based Python queuing library. What is the best practice of testing django apps which is using RQ? For example, if I want to test my app as a black box, after User makes…
Oduvan
  • 2,607
  • 3
  • 24
  • 24
13
votes
3 answers

Passing results to depending on job - python rq

How do I pass the result of a job to a job that depends on it? What I currently do is passing id of the first job to the second, first = queue.enqueue(firstJob) second = queue.enqueue(secondJob, first.id, depends_on=first); And inside secondJob…
Aruna Herath
  • 6,241
  • 1
  • 40
  • 59
13
votes
1 answer

Unsatisfactory job push performance with Python RQ

Trying to use python-rq to support the back end to our Web application, but pushing new jobs takes very long - up to 12 seconds. The performance hit happens when executing the enqueue_call function call, particularly when the number of worker…
Juan Carlos Coto
  • 11,900
  • 22
  • 62
  • 102
12
votes
1 answer

Django python-rq -- DatabaseError SSL error: decryption failed or bad record mac

I'm using the django-redis and django_rq frameworks to support both redis caching and redis background task processing for my Django application on Heroku. It's worked smoothly in the past, however now I keep getting a DatabaseError SSL error:…
fangsterr
  • 3,670
  • 4
  • 37
  • 54
12
votes
3 answers

Cancel an already executing task in Python RQ?

I am using http://python-rq.org/ to queue and execute tasks on Heroku worker dynos. These are long-running tasks and occasionally I need to cancel them in mid-execution. How do I do that from Python? from redis import Redis from rq import Queue from…
Charles Offenbacher
  • 3,094
  • 3
  • 31
  • 38
11
votes
1 answer

Get *all* current jobs from python-rq

I'm using python-rq to manage Redis-based jobs and I want to determine which jobs are currently being processed by my workers. python-rq offers a get_current_job function to find 'the current job' for a connection but: I can't get this to work,…
Andrew Mackie
  • 344
  • 3
  • 13
9
votes
3 answers

rq timeout param in enqueue call not working, giving JobTimeoutException

I am trying to change the timeout on an rq job but nothing seems to work. I've got something to the effect of: my_queue = Queue('my_task', connection=Redis()) job_args = (1, 2, 4) my_queue.enqueue_call( my_func, …
Obj3ctiv3_C_88
  • 1,478
  • 1
  • 17
  • 29
9
votes
1 answer

how to explicitely give priorities to the queues with python-rq

I am trying python-rq and I do not see how to explicitely give priorities to the queues? Does the priority come from the order they are defined when the worker is launched? rqworker queueA queueB queueC queueA is prioritized compare to queueB and…
Michael
  • 8,357
  • 20
  • 58
  • 86
8
votes
1 answer

What are Queue classes, Worker Classes, Job Classes in Python rq package

While reading through the rq docs, I notice that there are some arguments that you can pass to rq worker when starting the worker Example: rq worker --worker-class 'foo.bar.MyWorker' Argument list includes --worker-class or -w: RQ Worker class to…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
1
2 3
11 12