zoukankan      html  css  js  c++  java
  • python Apscheduler持久化

    from pytz import utc
    
    from apscheduler.schedulers.background import BackgroundScheduler
    from apscheduler.jobstores.mongodb import MongoDBJobStore
    from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
    from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
    
    
    jobstores = {
      # 使用sqlite数据库存储,如需其它数据库存储需要指定
      'default': SQLAlchemyJobStore(url='sqlite:///jobs.sqlite')
    }
    executors = {
      'default': ThreadPoolExecutor(20),
      'processpool': ProcessPoolExecutor(5)
    }
    job_defaults = {
      'coalesce': False,
      'max_instances': 3
    }
    scheduler = BackgroundScheduler(jobstores=jobstores, 
    executors=executors, job_defaults=job_defaults, timezone=utc)
    scheduler.start()
    

    -------------------------------------------

    个性签名:代码过万,键盘敲烂!!!

    如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!

  • 相关阅读:
    ES6中对象新增方法
    ES6中字符串新增方法
    Laya 吐槽日志.
    汇编与反汇编工具
    Mac 软件下载地址
    红米手机 android4.4.4 root之路
    查看apk安装包信息
    文件搜索
    自动发表QQ空间说说
    批量格式化json
  • 原文地址:https://www.cnblogs.com/weiweivip666/p/15792553.html
Copyright © 2011-2022 走看看