rq / rq-scheduler

A lightweight library that adds job scheduling capabilities to RQ (Redis Queue)
MIT License
1.45k stars 230 forks source link

Jobs can not be queued? #236

Closed vking34 closed 4 years ago

vking34 commented 4 years ago

I run the rq-scheduler with the following command: $ rqscheduler -i 10 -v

And my main.py:

from redis import Redis
from rq import Queue
from rq_scheduler import Scheduler
from datetime import datetime, timedelta
from jobs.tasks import log
import time

redis_connection = Redis()

# queue = Queue(connection=redis_connection)
scheduler = Scheduler(connection=redis_connection)

job0 = scheduler.schedule(
    scheduled_time=datetime.utcnow(),
    func=log,
    args=['abc'],
    interval=5,
    repeat=5
)
job1 = scheduler.enqueue_in(timedelta(seconds=5), log, 'abc')

print(job0.get_status())
print(job1.get_status())
time.sleep(1)
print(job0.get_status())
print(job1.get_status())

but when i run the app, i got output:

None
None
None
None

That means these jobs have not been queued ? Please help me. Thank you for reading.

selwin commented 4 years ago

You can check whether there's anything in the scheduler using scheduler.get_jobs()

mikenester commented 2 years ago

@vking34 Did you find a resolution to this issue? I'm experiencing the same thing.