Skip to main content

A tiny job queue framework.

Project description

A tiny job queue framework.

Install

pip install tinyq

Usage

app.py

from tinyq import Application

app = Application()


@app.task()
def add(m, n):
    return m + n

添加队列任务

for m in range(10):
    for n in range(3):
        add.delay(m, n)

启动 worker

$ tinyq
2017-02-19 22:58:50,676 - WARNING - runner - start - 72 - MainProcess - MainThread - Starting TinyQ worker, version 0.1.0...
2017-02-19 22:58:51,796 - INFO - worker - run_once - 56 - MainProcess - Worker-6 - Got a job: <Job: id: 91eb9414-7d61-4234-8ab7-b691f0c4e390, task_name: add>
2017-02-19 22:58:51,796 - INFO - worker - run_once - 58 - MainProcess - Worker-6 - Finish run job <Job: id: 91eb9414-7d61-4234-8ab7-b691f0c4e390, task_name: add>
2017-02-19 22:58:51,931 - INFO - worker - run_once - 56 - MainProcess - Worker-2 - Got a job: <Job: id: 10e4751f-6832-45df-8910-465725cc250d, task_name: add>
2017-02-19 22:58:51,931 - INFO - worker - run_once - 58 - MainProcess - Worker-2 - Finish run job <Job: id: 10e4751f-6832-45df-8910-465725cc250d, task_name: add>
^C2017-02-19 22:58:52,205 - WARNING - runner - start - 83 - MainProcess - MainThread - Warm shutdown...
2017-02-19 22:58:52,205 - WARNING - runner - start - 94 - MainProcess - MainThread - Exit worker.
2017-02-19 22:58:52,439 - WARNING - runner - func - 126 - MainProcess - Worker-5 - Exit worker Worker-5.
2017-02-19 22:58:52,488 - WARNING - runner - func - 126 - MainProcess - Worker-0 - Exit worker Worker-0.
2017-02-19 22:58:52,536 - WARNING - runner - func - 126 - MainProcess - Worker-3 - Exit worker Worker-3.
2017-02-19 22:58:52,972 - WARNING - runner - func - 126 - MainProcess - Worker-2 - Exit worker Worker-2.
2017-02-19 22:58:52,972 - WARNING - runner - func - 126 - MainProcess - Scheduler - Exit worker Scheduler.
2017-02-19 22:58:53,192 - WARNING - runner - func - 126 - MainProcess - Worker-7 - Exit worker Worker-7.
2017-02-19 22:58:53,542 - WARNING - runner - func - 126 - MainProcess - Worker-1 - Exit worker Worker-1.
2017-02-19 22:58:53,720 - WARNING - runner - func - 126 - MainProcess - Worker-6 - Exit worker Worker-6.
2017-02-19 22:58:53,917 - WARNING - runner - func - 126 - MainProcess - Worker-4 - Exit worker Worker-4.
$

Project details


Download files

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

Source Distribution

TinyQ-0.1.0.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distributions

tinyq-0.1.0-py2.py3-none-any.whl (10.5 kB view hashes)

Uploaded Python 2 Python 3

TinyQ-0.1.0-py2.py3-none-any.whl (10.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page