Skip to content
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

The @job decorator is not working as documented #2087

Open
naskio opened this issue May 11, 2024 · 0 comments
Open

The @job decorator is not working as documented #2087

naskio opened this issue May 11, 2024 · 0 comments

Comments

@naskio
Copy link
Contributor

naskio commented May 11, 2024

I am new to rq and I am to run the following code (extracted from the docs#The @job decorator)

import redis
import rq
from rq.decorators import job
import time

r = redis.Redis(host='localhost', port=6379)
q = rq.Queue(connection=r)


@job('default', connection=r, timeout=5)
def add(x, y):
    return x + y


job = add.enqueue(3, 4)
time.sleep(1)
print(job.return_value())

Running this code is raising the following error:

AttributeError: 'function' object has no attribute 'enqueue'

rq version: 1.16.2
python version: 3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant