MIT License

项目介绍

tastyware/streaq 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 150 个 Star、12 次 Fork。

仓库全名
tastyware/streaq
开源许可证
MIT License
Star 数
150
Fork 数
12
未关闭 Issue
2

README 摘要

streaQ Fast, async, fully-typed distributed task queue via Redis streams Features Up to 14x faster than arq Fully typed Comprehensive documentation Support for delayed/scheduled tasks Cron jobs Task middleware Dead-letter queue Pipelining Priority queues Support for synchronous tasks (run in separate threads) Redis Sentinel & Cluster support for production Built-in web UI for monitoring tasks Built with structured…

完整内容见 GitHub 原始 README 或本页 。

常见问题

streaq 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 150 个 Star。

streaq 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 streaq 的源码?

可以直接克隆仓库:git clone https://github.com/tastyware/streaq.git;安装与运行步骤见仓库 README。

streaq 最近还在维护吗?

仓库最近一次更新为 6月18日,当前有 2 个未关闭 Issue;Star 数为 150,可作为社区活跃度的参考。

关于

Fast, async, fully-typed distributed task queue via Redis streams

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
324
价值分
108
活跃状态
活跃

README

Docs PyPI Downloads Release Coverage

streaQ

Fast, async, fully-typed distributed task queue via Redis streams

Features

  • Up to 14x faster than arq
  • Fully typed
  • Comprehensive documentation
  • Support for delayed/scheduled tasks
  • Cron jobs
  • Task middleware
  • Dead-letter queue
  • Pipelining
  • Priority queues
  • Support for synchronous tasks (run in separate threads)
  • Redis Sentinel & Cluster support for production
  • Built-in web UI for monitoring tasks
  • Built with structured concurrency on anyio, supports both asyncio and trio
Tip 提示

Sick of redis-py? Check out coredis, a fast, fully-typed Redis client that supports Trio!

Installation

$ pip install streaq

Getting started

To start, you’ll need to create a Worker object:

from streaq import Worker

worker = Worker(redis_url="redis://localhost:6379", anyio_backend="trio")

You can then register async tasks with the worker like this:

import trio

@worker.task
async def sleeper(time: int) -> int:
    await trio.sleep(time)
    return time

@worker.cron("* * * * mon-fri")  # every minute on weekdays
async def cronjob() -> None:
    print("Nobody respects the spammish repetition!")

Finally, let’s use the worker’s async context manager to queue up some tasks:

async with worker:
    await sleeper.enqueue(3)
    # enqueue returns a task object that can be used to get results/info
    task = await sleeper.enqueue(1).start(delay=3)
    print(await task.info())
    print(await task.result(timeout=5))

Putting this all together gives us example.py. Let’s spin up a worker:

$ streaq run example:worker

and queue up some tasks like so:

$ python example.py

Let’s see what the output looks like:

[INFO] 2025-09-23 02:14:30: starting worker 3265311d for 2 functions
[INFO] 2025-09-23 02:14:35: task sleeper □ cf0c55387a214320bd23e8987283a562 → worker 3265311d
[INFO] 2025-09-23 02:14:38: task sleeper ■ cf0c55387a214320bd23e8987283a562 ← 3
[INFO] 2025-09-23 02:14:40: task sleeper □ 1de3f192ee4a40d4884ebf303874681c → worker 3265311d
[INFO] 2025-09-23 02:14:41: task sleeper ■ 1de3f192ee4a40d4884ebf303874681c ← 1
[INFO] 2025-09-23 02:15:00: task cronjob □ 2a4b864e5ecd4fc99979a92f5db3a6e0 → worker 3265311d
Nobody respects the spammish repetition!
[INFO] 2025-09-23 02:15:00: task cronjob ■ 2a4b864e5ecd4fc99979a92f5db3a6e0 ← None
TaskInfo(fn_name='sleeper', enqueue_time=1751508876961, tries=0, scheduled=datetime.datetime(2025, 7, 3, 2, 14, 39, 961000, tzinfo=datetime.timezone.utc), child=None)
TaskResult(fn_name='sleeper', enqueue_time=1751508876961, success=True, start_time=1751508880500, finish_time=1751508881503, tries=1, worker_id='ca5bd9eb', _result=1)

For more examples, check out the documentation.

评论

暂无评论