当前位置: 首页 > 工具软件 > py-task > 使用案例 >

可以调度python的工具_py-task Python任务调度工具

白君之
2023-12-01

py-task是一个Python下的任务调度工具

支持简单的周期性调度

支持Cron格式的任务调度

安装方法

python setup.py install

或者

pip install py-task

示例代码:

from task import taskfrom task import task_containerfrom task.job import jobfrom task.trigger import cron_triggerclass MyJob(job.Job):    def __init__(self):        pass    def execute(self):        print 'Hello now is ' + str(time.time())cron = '0-59/5 10,15,20 * * * * 2015'new_task = task.Task('Task', MyJob(), cron_trigger.CronTrigger(cron))container.add_task(new_task)container.start_all()

 类似资料: