jinsong07 / tornado-crontab

tornado-crontab is a library that can make the task apps like crontab.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tornado-crontab

tornado-crontab is a library that can make the task apps like crontab.

Travis CI AppVeyor Code Climate Requirements Status

Installation

Automatic installation:

$ pip install tornado-crontab

torando-crontab is listed in PyPI and can be installed with pip or easy_install.

Manual installation:

$ git clone https://github.com/gaujin/tornado-crontab.git
$ cd tornado-crontab
$ python setup.py install

tornado-crontab source code is hosted on GitHub

Usage

Here is an example every minute task app:

from __future__ import print_function
import functools
import tornado.ioloop
import tornado_crontab

def hello_crontab(value):

    print("Hello, {0}".format(value))

if __name__ == "__main__":

    _func = functools.partial(hello_crontab, *["crontab"])
    tornado_crontab.CronTabCallback(_func, "* * * * *").start()
    tornado.ioloop.IOLoop.instance().start()    

decorator style task app:

from __future__ import print_function
import tornado.ioloop
from tornado_crontab import crontab

@crontab("* * * * *")
def hello_crontab(value):

    print("Hello, {0}".format(value))

if __name__ == "__main__":

    hello_crontab("crontab")
    tornado.ioloop.IOLoop.instance().start()

Using

License

See the LICENSE file for specific terms.

About

tornado-crontab is a library that can make the task apps like crontab.

License:MIT License


Languages

Language:Python 100.0%