APScheduler API -- apscheduler.triggers.date
apscheduler.triggers.date
API
Trigger alias for add_job(): date
- class apscheduler.triggers.date.DateTrigger(run_date=None, timezone=None)
-
Bases: apscheduler.triggers.base.BaseTrigger
Triggers once on the given datetime. If run_date is left empty, current time is used.
Parameters: - run_date (datetime|str) – the date/time to run the job at
- timezone (datetime.tzinfo|str) – time zone for run_date if it doesn’t have one already
Introduction
This is the simplest possible method of scheduling a job. It schedules a job to be executed once at the specified time. It is APScheduler’s equivalent to the UNIX “at” command.
The run_date can be given either as a date/datetime object or text (in the ISO 8601 format).
Examples
from datetime import date from apscheduler.scheduler import BlockingScheduler sched = BlockingScheduler() def my_job(text):
print(text) # The job will be executed on November 6th, 2009
sched.add_job(my_job, 'date', run_date=date(2009, 11, 6), args=['text']) sched.start()
You can specify the exact time when the job should be run:
# The job will be executed on November 6th, 2009 at 16:30:05
sched.add_job(my_job, 'date', run_date=datetime(2009, 11, 6, 16, 30, 5), args=['text'])
The run date can be given as text too:
sched.add_job(my_job, 'date', run_date='2009-11-06 16:30:05', args=['text'])
To add a job to be run immediately:
# The 'date' trigger and datetime.now() as run_date are implicit
sched.add_job(my_job, args=['text'])
APScheduler API -- apscheduler.triggers.date的更多相关文章
- APScheduler API -- apscheduler.triggers.interval
apscheduler.triggers.interval API Trigger alias for add_job(): interval class apscheduler.triggers.i ...
- APScheduler API -- apscheduler.triggers.cron
apscheduler.triggers.cron API Trigger alias for add_job(): cron class apscheduler.triggers.cron.Cron ...
- APScheduler API -- apscheduler.schedulers.base
apscheduler.schedulers.base API class apscheduler.schedulers.base.BaseScheduler(gconfig={}, **option ...
- Java 基础 常用API ( 正则表达式,Date类,DateFormat类,Calendar类 )
正则表达式 正则表达式的概念 正则表达式(英语:Regular Expression,在代码中常简写为regex). 正则表达式是一个字符串,使用单个字符串来描述.用来定义匹配规则,匹配一系列符合某个 ...
- Java8 Time API与老Date之间的转换
前面我已经总结了Java8 Time API常用的一些方法.封装的工具类,可是最近需要对一个比较老的项目进行重构,大致看了一下使用的Jdk还是7而且里面的时间工具类还是使用的Date和Calendar ...
- 常用API——日期型函数Date
上图 ·声明 var myDate = new Date(); //系统当前时间 var myDate = new Date(yyyy, mm, dd, hh, mm, ss); var myDate ...
- [Day16]常用API(正则表达式、Date类、DateFormat类、Calendar类)
1.正则表达式(Regular Expression,regex)-是一个字符串,使用单个字符串来描述.用来定义匹配规则,匹配一系列符合某个句法规则的字符串 1.1匹配规则: (1)字符:x -代表的 ...
- Python 定时任务框架 APScheduler 详解
APScheduler 最近想写个任务调度程序,于是研究了下 Python 中的任务调度工具,比较有名的是:Celery,RQ,APScheduler. Celery:非常强大的分布式任务调度框架 R ...
- python APScheduler模块
简介 一般来说Celery是python可以执行定时任务, 但是不支持动态添加定时任务 (Django有插件可以动态添加), 而且对于不需要Celery的项目, 就会让项目变得过重. APSchedu ...
随机推荐
- SPOJ_LCS
经典题目,求两个串的最长公共子串. 是这样来做的. 以第一个串构造SAM,第二个串在自动机上跟新一遍就可以了. 更新的过程是这样的,假设当前到达的状态点为x(初始状态为0点),下一个字符是c,如果当前 ...
- UVAlive6439_Pasti Pas!
题目是说给你一个字符串,现在要你用一些特殊的符号代替这个字符串中某一些子串,使得被替换后的串是一个回文串. 现在要你求替换后的字符串的最大的可能的长度. 其实这个题目没有什么固定的算法哦,我直接暴力就 ...
- (转)Python中如何理解if __name__ == '__main__'
摘要 通俗的理解 __name__ == '__main__' :假如你叫李凯.py,在朋友眼中,你是李凯( __name__ == '李凯' ):在你自己眼中,你是你自己( __name__ == ...
- Distinct Substrings SPOJ - DISUBSTR(后缀数组水题)
求不重复的子串个数 用所有的减去height就好了 推出来的... #include <iostream> #include <cstdio> #include <sst ...
- Rotting Oranges - LeetCode
目录 题目链接 注意点 解法 小结 题目链接 Rotting Oranges - LeetCode 注意点 解法 解法一:bfs.首先先统计所有新鲜的橘子数目fresh,如果fresh大于0则一直执行 ...
- linux系统之定制rpm包
FPM打包工具 FPM的作者是jordansissel FPM的github:https://github.com/jordansissel/fpm FPM功能简单说就是将一种类型的包转换成另一种类型 ...
- Android Studio怎么文件添加到收藏和打开收藏夹
http://jingyan.baidu.com/article/1709ad809e608b4634c4f0b9.html 在使用Android studio编写的代码的过程中,有时会碰到有一些文件 ...
- Android中View绘制优化
1.优化布局层次 http://www.2cto.com/kf/201209/154108.html 2.使用<include />标签复用布局文件 http://www.2cto.com ...
- 【贪心】【CF1061D】 TV Shows
Description 给定 \(n\) 个电视节目和两个参数 \(x,y\).你想要看全部的电视节目,但是同一个电视机同一个时刻只能播放一个电视节目,所以你只能多租赁电视机.在时间 \([l,r]\ ...
- Ansible12:lookup
目录 简单说明 1.file 2.pipe 3.env 4.template 5.csvfile 6.redis_kv 7.etcd 8.password 9.dnstxt 简单说明 在通常情况下,所 ...