<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          RQ SchedulerRQ 作業(yè)調(diào)度

          聯(lián)合創(chuàng)作 · 2023-09-29 15:15

          RQ Scheduler 是一個小型的 Python 包,用來給 RQ 添加作業(yè)調(diào)度功能。

          安裝:

          pip install rq-scheduler

          示例代碼:

          from redis import Redis
          from rq_scheduler import Scheduler
          from datetime import datetime
          
          scheduler = Scheduler(connection=Redis()) # Get a scheduler for the "default" queue
          
          # Puts a job into the scheduler. The API is similar to RQ except that it
          # takes a datetime object as first argument. So for example to schedule a
          # job to run on Jan 1st 2020 we do:
          scheduler.enqueue_at(datetime(2020, 1, 1), func)
          
          # Here's another example scheduling a job to run at a specific date and time (in UTC),
          # complete with args and kwargs.
          scheduler.enqueue_at(datetime(2020, 1, 1, 3, 4), func, foo, bar=baz)

          第二種方法:

          from datetime import timedelta
          
          # Schedule a job to run 10 minutes, 1 hour and 1 day later
          scheduler.enqueue_in(timedelta(minutes=10), count_retweets, tweet_id)
          scheduler.enqueue_in(timedelta(hours=1), count_retweets, tweet_id)
          scheduler.enqueue_in(timedelta(days=1), count_retweets, tweet_id)
          瀏覽 24
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  在线观看小黄片 | 日韩高清一区 | 国产精品久久久久久欧 | 中文字幕在线亚洲精品 | 伊人网大香蕉视频 |