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 ...
随机推荐
- Office/Visio/Project 2010 RTM (x86) (x64)(中文简体/英文)
1.cn_office_professional_plus_2010_x64_515528.exe ed2k://|file|cn_office_professional_plus_2010_x64_ ...
- multi thread for Java
I try to do a testing for HashTable Sychronized behavior today. As an Sychronized Object, HashTable ...
- 再看case语句
再看case语句,case语句只处理单条记录,而不是set 列名的使用,可以当做数值来使用: case when 后面简直是完美的的,什么东西都是能放的,只要是一个逻辑上的true/false的逻辑就 ...
- 拦截器的顺序是按照xml中的顺序执行的
- 【Java并发编程】之七:使用synchronized获取互斥锁的几点说明
在并发编程中,多线程同时并发访问的资源叫做临界资源,当多个线程同时访问对象并要求操作相同资源时,分割了原子操作就有可能出现数据的不一致或数据不完整的情况,为避免这种情况的发生,我们会采取同步机制,以确 ...
- 基于c的简易计算器一
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <malloc.h&g ...
- C语言中变量名及函数名的命名规则与驼峰命名法
一.C语言变量名的命名规则:(可以字母,数字,下划线混合使用) 1. 只能以字母或下划线开始:2. 不能以数字开始:3. 一般小写:4. 关键字不允许用(eg:int float=2//error ...
- MT【130】Heilbronn问题
(清华THUSSAT,多选题) 平面上 4 个不同点 \(P_1,P_2,P_3,P_4\),在每两个点之间连接线段得到 6 条线段. 记 \[L=\max_{1\leq i<j\leq 4}| ...
- Java并发编程中线程池源码分析及使用
当Java处理高并发的时候,线程数量特别的多的时候,而且每个线程都是执行很短的时间就结束了,频繁创建线程和销毁线程需要占用很多系统的资源和时间,会降低系统的工作效率. 参考http://www.cnb ...
- JS的对象原型
1.对象 1.1 语法 对象可以通过两种形式定义:声明(文字)形式和构造形式. 对象的文字语法: var myObj = { key : value //... }; 对象的构造语法: var myO ...