from apscheduler.schedulers.blocking import BlockingScheduler
from datetime import datetime
def my_job(x=None):
print 'hello world'
  print x
sched = BlockingScheduler()
sched.add_job(my_job, 'interval', seconds=5) #每5秒执行一次
sched.start()
############


apscheduler 官网http://pypi.python.org/pypi/APScheduler/2.0.3
from apscheduler.schedulers.blocking import BlockingScheduler
def my_job(x=None):
print x sched = BlockingScheduler()
sched.add_job(my_job, 'interval', seconds=2, start_date='2017-02-22 17:46:59',args=[''])#在
start_date开始没2秒执行一次

interval 间隔调度

它的参数如下:

weeks(int) – number of weeks to wait

days(int) – number of days to wait

hours(int) – number of hours to wait

minutes(int) – number of minutes to wait

seconds(int) – number of seconds to wait

start_date(datetime|str) – starting point for the interval calculation

end_date(datetime|str) – latest possible date/time to trigger on

更多:http://www.tuicool.com/articles/FbeIRzI

http://www.cnblogs.com/timliucn/p/5894361.html

$ pip install schedule
import schedule
import time def job():
print("I'm working...") schedule.every(10).minutes.do(job)
schedule.every().hour.do(job)
schedule.every().day.at("10:30").do(job)
schedule.every().monday.do(job)
schedule.every().wednesday.at("13:15").do(job)
# schedule.every(1).seconds.do(job)
while True: schedule.run_pending() time.sleep(1)

https://pypi.python.org/pypi/schedule/官网地址

python apscheduler的使用的更多相关文章

  1. python APScheduler

    简介 APScheduler基于Quartz的一个Python定时任务框架,实现了Quartz的所有功能,使用起来十分方便.提供了基于日期.固定时间间隔以及crontab类型的任务,并且可以持久化任务 ...

  2. thinkphp5+python.apscheduler实现计划任务

    1.thinkphp5配置自定义命令行 /application/console/command namespace app\console\command; use think\console\Co ...

  3. python APScheduler模块

    简介 一般来说Celery是python可以执行定时任务, 但是不支持动态添加定时任务 (Django有插件可以动态添加), 而且对于不需要Celery的项目, 就会让项目变得过重. APSchedu ...

  4. APScheduler

    目录 APScheduler简介 支持的后端存储作业 集成的Python框架 APScheduler下载安装 APScheduler组件 各组件简介 调度器 作业存储器 执行器 触发器 使用 添加作业 ...

  5. App后台开发架构实践笔记

    1 App后台入门 1.1 App后台的功能 (1)远程存储数据: (2)消息中转. 1.2 App后台架构 架构设计的流程 (1) 根据App的设计,梳理出App的业务流程: (2) 把每个业务流程 ...

  6. pip 自己的源 搭建

    1  安装工具 pip install  pip2pi 2  下载 所需要的包 pip2tgz /application/nginx/html/yum/python/ apscheduler (172 ...

  7. APP后台架构开发实践笔记

    1 App后台入门 1.1 App后台的功能 (1)远程存储数据: (2)消息中转. 1.2 App后台架构 架构设计的流程 (1) 根据App的设计,梳理出App的业务流程: (2) 把每个业务流程 ...

  8. Python任务调度模块 – APScheduler

    APScheduler是一个Python定时任务框架,使用起来十分方便.提供了基于日期.固定时间间隔以及crontab类型的任务,并且可以持久化任务.并以daemon方式运行应用.目前最新版本为3.0 ...

  9. Python定时任务框架APScheduler 3.0.3 Cron示例

    APScheduler是基于Quartz的一个Python定时任务框架,实现了Quartz的所有功能,使用起来十分方便.提供了基于日期.固定时间间隔以及crontab类型的任务,并且可以持久化任务.基 ...

随机推荐

  1. exec和xargs

    参考:http://www.cnblogs.com/itxdm/p/5936907.html 一. 先复习下find命令 1. name参数 find -name tom 或 find -iname ...

  2. UDP与IP分片

    一.引言  UDP是简单的面向数据报的运输层协议.UDP不提供可靠性:它负责把应用程序传给IP层的数据发送出去,不保证能导到目的地. 二.UDP首部  端口号表示发送进程和接受进程.由于IP层已经 ...

  3. 北航软院2013级C#期末考试部分考题解答

    博主注:本渣渣水平有限,文中若有不对的地方敬请指出,谢谢. 本文中大部分图片来自老师的PPT,感谢邵老师,想要的可以点击右边QQ联系我:) 一.选择题 2.Wrong statement? A.dou ...

  4. pip报failed to create process

    使用pip命令的时候报failed to create process 1.错误提示窗口如下图 2.报这个错误的原因,是因为你改动了python的目录名称或位置.因为,我的电脑是安装了anaconda ...

  5. iframe自适应高度,多层嵌套iframe自适应高度的解决方法

    在页面无刷新更新方面,虽然现在的ajax很强悍,但是处理代码相对多点.想比之下,iframe就简单多了!处理iframe的自适应宽.高,会经常用到,网上整理了一份,写在这里备用: 单个iframe 高 ...

  6. python学习,day1作业:设计一个三级菜单

    设计一个三级菜单,要求能够下钻,能够推出,比较笨的方法 # coding=utf-8 # Author: RyAn Bi data = { 'beijing':{ 'changping':{ 'wud ...

  7. ABP相关网站

    ABP的官方网站:http://www.aspnetboilerplate.com ABP在Github上的开源项目:https://github.com/aspnetboilerplate 系列文章 ...

  8. 问题记录——com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    最近在搞一个Spring boot + Mybatis + Mysql的项目,用Mybatis访问数据库时,报了如下的错误,先在网上搜索了,试了各种办法都不行, 奇葩的是,连接另外1个数据库又没问题. ...

  9. Hive动态分区 参数配置及语法

    Hive本身是不支持动态分区的.. 但动态分区是真的方便啊..不然手动维护要累死..按日期甚至小时来分区时动辄就好几千上万的分区..手动到哪一年去..? 想要用动态分区要先做一些设置来修改默认的配置. ...

  10. IONIC 打包安卓apk详细过程

    参照以下链接: https://blog.csdn.net/qq_20264891/article/details/79319408 当 cordova 项目安装的 android 平台版本 与 系统 ...