Skip to main content

Mutil-thread/mutil-process task scheduler drive by Tornado IOLoop for human.

Project description

Chronos is a mutil-thread/mutil-process task scheduler drive by Tornado IOLoop.


Install the extension with the following command:

$ easy_install chronospy

or alternatively if you have pip installed:

$ pip install chronospy

or clone it form github then run the command in shell:

cd chronos # the path to the project
python install

Hello World

import logging
import time
import tornado
import chronos
import os
import urllib2

def test_process():"process pid %s", os.getpid())

def test(word):"an other task, say '%s'", word)

def say():
    response = urllib2.urlopen('')
    html =[:10])

def init():
    global LOGGER
    debug = True
    level = logging.DEBUG if debug else logging.INFO
                        format='%(asctime)s %(levelname)-8s %(message)s',
                        datefmt='%Y-%m-%d %H:%M:%S', filemode='a+')

    LOGGER = logging.getLogger("demo")

    # bind a ioloop or use default ioloop
    chronos.setup()  # chronos.setup(tornado.ioloop.IOLoop())
    chronos.schedule('say', chronos.every_second(1), say)
    chronos.schedule('say2', chronos.every_second(1), test_process, once=True, process=True)
    chronos.schedule('say3', chronos.every_second(1), lambda: test("test3"))

if __name__ == '__main__':





bind a io_loop or use default ioloop.


schedule(name, timer, func, once=False, start=False, process=False, max_executor=5)

add task into chronos:

name:uniqe task name,
timer:every timer object
func:the task function
once:set True will run only once time.
start:when chronos start and schedule a new task, if set to True will add to Tornado IOLoop and schedule to run at time.
process:if process is True, then the job will run in on a procees, otherwise defaultly running in thread.
max_executor:the max threads(or processes) to run a task.



stop and remove the task from chronos



start the task in chronos



stop the task in chronos



add tasks in ioloop, if you use chronos in a tornado web server, you can set start_ioloop to “False”, then start your custom ioloop later.


stop(stop_ioloop=False, clear=True)

stop the task in ioloop

stop_ioloop:will stop the ioloop if set to “True”.
clear:will remove tasks from chrons if set to “True”.

how to use every tools


set eveny seconds to run a job:

every_second(5) # run job every 5 seconds


set every hourly or mintuely run a job:

every_at(hour=1, minute=10, second=0) # run at 01:10:00 every day
every_at(minute=10, second=0) # run at run at 10 mintue every hour




Copyright (C) 2015 Thomas Huang

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <>.


Version 0.1.3

Released on July 26 2015

  • Fixed signal handle

Version 0.1.2

Released on July 26 2015

  • Fixed process task terminate

Version 0.1.1

Chronos is a mutil-thread/mutil-process task scheduler drive by Tornado IOLoop.

Released on July 26 2015

  • first version

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for chronospy, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size chronospy-0.1.3.tar.gz (7.7 kB) File type Source Python version None Upload date Hashes View
Filename, size (13.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page