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

python任务调度工具_Python任务调度工具 py-task

邵子平
2023-12-01

软件介绍

py-task是一个Python下的任务调度工具支持简单的周期性调度

支持Cron格式的任务调度

安装方法python setup.py install

或者pip install py-task

示例代码:from task import task

from task import task_container

from task.job import job

from task.trigger import cron_trigger

class 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()

为你推荐:

 类似资料: