Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hhatto/kuroko
Minimalistic Python Task Executor
https://github.com/hhatto/kuroko
Last synced: about 1 month ago
JSON representation
Minimalistic Python Task Executor
- Host: GitHub
- URL: https://github.com/hhatto/kuroko
- Owner: hhatto
- Created: 2014-03-05T01:28:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-16T17:02:29.000Z (about 9 years ago)
- Last Synced: 2024-09-13T17:55:19.514Z (2 months ago)
- Language: Python
- Size: 219 KB
- Stars: 7
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
Kuroko
=======
.. image:: https://travis-ci.org/hhatto/kuroko.svg?branch=master
:target: https://travis-ci.org/hhatto/kurokoMinimalistic Python Task Executor Framework
Requirements
============
- Python2.7+
- Logbook_
- crontab_
- watchdog_.. _Logbook: https://pypi.python.org/pypi/Logbook
.. _crontab: https://pypi.python.org/pypi/crontabInstallation
============::
pip install kuroko
Usage
=====
examples5sec interval task execution
----------------------------.. code-block:: python
import kuroko
class MyBot(kuroko.Bot):
@kuroko.timer(5)
def echo_pong(self):
print("pong")bot = MyBot()
bot.start()crontab like task execution
---------------------------.. code-block:: python
class MyBot(kuroko.Bot):
@kuroko.crontab('*/5 * * * *')
def echo_pong(self):
print("pong")watchdog_ thin wrapper
----------------------.. code-block:: python
class MyBot(kuroko.Bot):
@kuroko.watch
def echo_pong(self, event):
print("pong", event)@kuroko.watch(patterns=['*.py'])
def echo_ping(self, event):
print("ping", event).. _watchdog: https://pypi.python.org/pypi/watchdog
logging
-------.. code-block:: python
class MyBot(kuroko.Bot):
@kuroko.crontab('*/5 * * * *')
def echo_pong(self):
self.log.info("app logging")Restart & Stop task
-------------------
send a SIGUSR1 when you want to restart the all tasks,
send a SIGHUP when you want to stop the all tasks.TODO
====
- [ ] support multi-thread model
- [ ] colorize logging
- [ ] statistics web frontend
- [ ] terminal like interfaceLicense
=======
MIT