-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not resolve a Redis connection #164
Comments
@rochacbruno does your code work if you omit |
EDIT: This comment is a mistake, see below. Don't do this.
from rq import get_current_job, Connection
def export_on_shell(name):
with Connection():
current_job = get_current_job()
# do excel xlwt writings
|
Ok! thanks. For this job I needed to go with Celery because of the deadline. But I am looking forward to use rq again and I am available for testing. |
Pardon me, I was wrong. Giving this a second look, the example from the docs should work and my previous comment was a mistake. Maybe this has something to do with how |
It seems like django-rq doesn't call setup_redis like what RQ's own rqworker script does on https://github.com/nvie/rq/blob/master/rq/scripts/rqworker.py#L49 . I'll fix this sometime in the next few days. |
Thanks! |
This should be fixed in rq/django-rq@eb707f7 . @rochacbruno can you try to see if using the latest version of |
Thanks, @selwin! |
I have followed this example: http://python-rq.org/docs/jobs/
The code:
excel_export/views.py
The Django shell
The above task is sent to the worker but if fails
The Traceback
[2013-01-18 02:01] INFO: worker: *** Listening on excel_export...
[2013-01-18 02:02] INFO: worker: excel_export: excel_export.views.export_on_shell('assinaturas_a_vencer') (88257e11-29f1-4f4e-9b6f-f25fd970fd84)
[2013-01-18 02:02] ERROR: horse: NoRedisConnectionException: Could not resolve a Redis connection.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/rq-0.3.3_dev-py2.7.egg/rq/worker.py", line 396, in perform_job
rv = job.perform()
File "/usr/local/lib/python2.7/dist-packages/rq-0.3.3_dev-py2.7.egg/rq/job.py", line 326, in perform
self._result = self.func(_self.args, *_self.kwargs)
File "/vagrant/spring5/src/excel_export/views.py", line 217, in export_on_shell
current_job = get_current_job()
File "/usr/local/lib/python2.7/dist-packages/rq-0.3.3_dev-py2.7.egg/rq/job.py", line 59, in get_current_job
return Job.fetch(job_id)
File "/usr/local/lib/python2.7/dist-packages/rq-0.3.3_dev-py2.7.egg/rq/job.py", line 159, in fetch
job = cls(id, connection=connection)
File "/usr/local/lib/python2.7/dist-packages/rq-0.3.3_dev-py2.7.egg/rq/job.py", line 164, in init
self.connection = resolve_connection(connection)
File "/usr/local/lib/python2.7/dist-packages/rq-0.3.3_dev-py2.7.egg/rq/connections.py", line 64, in resolve_connection
'Could not resolve a Redis connection.')
NoRedisConnectionException: Could not resolve a Redis connection.
[2013-01-18 02:02] DEBUG: horse: Invoking exception handler <bound method Worker.move_to_failed_queue of <rq.worker.Worker object at 0x2f8b510>>
[2013-01-18 02:02] WARNING: horse: Moving job to failed queue.
[2013-01-18 02:02] INFO: worker:
[2013-01-18 02:02] INFO: worker: *** Listening on excel_export...
The text was updated successfully, but these errors were encountered: