Wiji is an asyncio distributed task processor/queue.
Project description
wiji
Codacy Badge CircleCI codecov Code style: black
Wiji is an asyncio distributed task processor/queue.
It’s name is derived from the late Kenyan hip hop artiste, Gwiji.
It is a bit like Celery
wiji has no third-party dependencies and it requires python version 3.7+
wiji is work in progress and very early. It’s API may change in
backward incompatible ways.
Installation
pip install wiji
Usage
1. As a library
import asyncio
import wiji
class AdderTask(wiji.task.Task):
async def run(self, a, b):
result = a + b
print("\nresult: {0}\n".format(result))
return result
broker = wiji.broker.InMemoryBroker()
myAdderTask = AdderTask(the_broker=broker, queue_name="AdderTaskQueue1")
# queue some tasks
myAdderTask.synchronous_delay(a=4, b=37)
myAdderTask.synchronous_delay(a=67, b=847)
# run the workers
worker = wiji.Worker(the_task=myAdderTask)
asyncio.run(worker.consume_tasks())
2. As a cli app
wiji also ships with a commandline interface app called wiji-cli.
create a wiji config file(which is just any python file that has a
class instance of wiji.conf.WijiConf), eg;
examples/my_config.py
import wiji
class AdderTask(wiji.task.Task):
async def run(self, a, b):
res = a + b
return res
BROKER = wiji.broker.InMemoryBroker()
myAdderTask = AdderTask(the_broker=BROKER, queue_name="AdderTaskQueue")
MyConfigInstance = wiji.conf.WijiConf(tasks=[myAdderTask])
NB: the directory where your place that file(in this case;
examples/) ought to be in your PYTHONPATH
then run wiji-cli pointing it to the dotted path of the
wiji.conf.WijiConf instance:
wiji-cli --config examples.my_config.MyConfigInstance
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wiji-0.1.2.tar.gz
(23.2 kB
view hashes)
Built Distribution
wiji-0.1.2-py3-none-any.whl
(27.4 kB
view hashes)