py-task - Python任务调度工具


Apache
跨平台
Python

软件简介

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