一个简明的调度模块——用于Python的简明调度。
conciseSchedules的Python项目详细描述
简明日程安排
简明工作进度表
一、“crontab任务”,court,crontab,shell,subprocess,子过程。存放。 一、“调度任务”,crontab,conciseschedules,可调用python,线程。存放。
工作日程安排
简明日程{
“second”:int或none或tuple(strat,end),
“minute”:int或none或tuple(strat,end),
“小时”:int或none或tuple(strat,end),
“day”:int或none或tuple(strat,end),
“月”:int或none或tuple(strat,end),
“工作日”:int或none或tuple(strat,end),
}
一、无。无。
没有,没有。
2.国际关系,>;=0;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;国际关系;八。如果传-1, 则相当于crontab "*/1"的语法, 即"每1(秒, 分, 时, 日, 月, 周)", 其中'weekday' 0表示星期日, 1-6表示星期一至星期六, 传-1的话, 会被解释为每周启动一次, 且时间设定为每周1的1点1分启动.
3.输入法。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test.py
def test():
print('hello conciseSchedules!', test.__name__)
if __name__ == '__main__':
import conciseSchedules as scheduler
tasks_conf = {
'schedule_tasks':[
{'schedule':{'second': -1}, 'target': test,} # 每秒钟启动一次
{'schedule':{'minute': -1}, 'target': test,} # 每分钟启动一次. 默认是每分钟的第1秒.
{'schedule':{'second': 15, 'minute': (10-20))}, 'target': test,} # 每小时的10-12分的第15秒启动
{'schedule':{'hour': -1)}, 'target': test,} # 每小时启动一次.默认是每小时的1分1秒.
{'schedule':{'minute': 1, 'hour': 10, 'day': 1, 'month': 10)}, 'target': test,} # 每年10月1日10点1分启动.
],
}
scheduler.set_tasks(tasks_conf)
scheduler.run_loop()
这样就
你还可以这样:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test.py
def test():
print('hello conciseSchedules!', test.__name__)
if __name__ == '__main__':
import conciseSchedules as scheduler
task = {'schedule_tasks': {'schedule':{'second': -1}, 'target': test,}} # 每秒钟启动一次
scheduler.add_task(task)
scheduler.run_loop()
承办单位。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test.py
import conciseSchedules as scheduler
@scheduler.task(schedule={'second': -1})
def test():
print('hello conciseSchedules!', test.__name__)
if __name__ == '__main__':
scheduler.run_loop()
[谚]功能测定法一、功能
已完成
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test.py
import conciseSchedules as scheduler
@scheduler.task(schedule={'second': -1}, args=('Tony'), kwargs={'age': 18})
def test(name, age=None):
print('hello conciseSchedules!', name, age)
if __name__ == '__main__':
scheduler.run_loop()
合作伙伴关系。注“工作日程安排”合作方式,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test.py
import conciseSchedules as scheduler
@scheduler.task(schedule={'second': -1})
def test():
print('hello conciseSchedules!', test.__name__)
if __name__ == '__main__':
scheduler.run_loop()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test.py
import conciseSchedules as scheduler
@scheduler.task(schedule={'second': -1}, args=('Tony'), kwargs={'age': 18})
def test(name, age=None):
print('hello conciseSchedules!', name, age)
if __name__ == '__main__':
scheduler.run_loop()
合作伙伴关系。注“工作日程安排”合作方式,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab,crontab。
================
下面是“crontab_tasks”施工合作:
crontab“日”发出。支持语:“”政府,“/3”3(25972;38500;3),“1-10”1至10间,“1”31934;30830到1.例:“/11**”横切。如果 周 的参数是 " /1", 则表示每周启动一次, 且启动时间在周1, 如果是" /> 1", 则会被解释成"能 整除 大于1的数的星期几启动" 而不是每年的第几周启动. 至after它,请21442;考crontab档。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# test.py
def test():
print('hello conciseSchedules!', test.__name__)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# start.py
if __name__ == '__main__':
import conciseSchedules as scheduler
tasks_conf = {
'crontab_tasks':[
{'crontab':'*/1 ', 'target': test,} # 每分钟启动一次. 默认是每分钟的第1秒.
{'crontab':"", 'target': test,} # 每小时的10-12分启动
{'crontab':{'hour': -1)}, 'target': test,} # 每小时启动一次.默认是每小时的1分1秒.
{'crontab':{'minute': 1, 'hour': 10, 'day': 1, 'month': 10)}, 'target': test,} # 每年10月1日10点1分启动.
],
}
scheduler.set_tasks(tasks_conf)
scheduler.run_loop()
"""如果要配合系统 crontab 来使用, 请使用 scheduler.run() 方法"""