Python(11) APScheduler
来源:互联网 发布:一键抠图软件电脑 编辑:程序博客网 时间:2024/06/01 09:37
1. 前言
- 官网
- 源码
- 参考博客1
- 参考博客2
2. 组件介绍
- triggers:什么时候触发任务。
- cron:功能最强大,可以指定时间、时间间隔、时间范围等。参考
- date:指定某个时间点出发,只执行一次。
- interval:指定时间间隔出发任务,可指定时间范围。
- job stores:默认情况下将任务保存在内存中。还没用到需要序列化到数据库的情况。
- executors:执行Job,主要取决于用了什么框架。默认使用线程池,常用的还有进程池。
- schedulers:用于管理以上三个组件。
- BlockingScheduler:程序只有调度器运行时选择。
- BackgroundScheduler:没有使用其他框架,且希望调度器在应用后台运行。
- 其他的就是各种框架。
3. 主要功能(参考官方文档)
- 添加Job
- 移除Job
- 暂停/恢复Job
- 获取Job列表
- 修改Job
- 关闭调度器
4. 实例
from apscheduler.schedulers.blocking import BlockingSchedulersched = BlockingScheduler()def my_job(): print 'my_job is running, Now is %s' % datetime.now().strftime("%Y-%m-%d %H:%M:%S")sched.add_job(my_job,'interval',id='myjob',seconds=5)sched.start() # 阻塞执行
阅读全文
0 0
- Python(11) APScheduler
- 【python】python APScheduler 框架
- Python的APScheduler模块
- Python 任务调度-APScheduler
- Python定时任务框架APScheduler
- Python定时任务框架APScheduler
- Python定时任务框架APScheduler
- Python APScheduler任务调度器
- Python定时任务框架APScheduler
- APscheduler
- apscheduler
- 【python】Python任务调度模块 – APScheduler
- python定时任务运行框架APScheduler解析
- Python中APScheduler模块的使用
- Python任务调度模块 – APScheduler
- Python任务调度模块 – APScheduler
- python调度框架APScheduler使用详解
- Python任务调度模块 – APScheduler
- Elasticsearch
- UVA-12260-Free Goodies
- Android本地单元测试-mockito的使用(Kotlin版本)
- SpringBoot入门之常用注解
- Python学习之路---Python 字符串
- Python(11) APScheduler
- MySQL 修改数据表--删除约束
- Windows 7下通过anaconda安装tensorflow
- .NET快速信息化系统开发框架 V3.2 -> Web 用户管理模块编辑界面-组织机构选择支持级联选择
- 2017idea的激活方法
- 浅谈常见的target=_blank
- 设计一个学生类Student
- Leetcode之Edit Distance 问题
- 大数据学习21:sqoop 语法和常用命令和小案例