RQ を使用してキューに入れられたジョブを実行しようとしていますが、次の例を見ています。
from rq import Queue
from redis import Redis
from somewhere import count_words_at_url
# Tell RQ what Redis connection to use
redis_conn = Redis()
q = Queue(connection=redis_conn) # no args implies the default queue
# Delay execution of count_words_at_url('http://nvie.com')
job = q.enqueue(count_words_at_url, 'http://nvie.com')
print job.result # => None
# Now, wait a while, until the worker is finished
time.sleep(2)
print job.result # => 889
なるほどtime.sleep(2)
- そして、これが指定する必要があるかどうか疑問に思っていました. 私がスケジュールしたジョブは、完了するまでに (時々) 1 時間かかることがあります (これはジョブごとに異なります)。
RQ は、実行時間が大幅に変化するようなジョブにまだ適していますか?
どんな提案も素晴らしいでしょう!