一个极简的分布式任务模块
Project description
Job Hive
基于Redis实现的轻量级分布式任务队列系统
🚀 功能特性
- 支持任务推送、执行生命周期管理
- 提供Redis队列实现(支持密码认证)
- 上下文管理器简化资源管理
- 支持任务批处理(示例中含单任务推送)
📦 安装依赖
目前仅支持Python3.10+,于 0.1.3 版本在原来 Redis 的基础上,加入简易版本的 Kafka 支持
pip install job_hive[redis]
🛠️ 使用示例
from job_hive import HiveWork
from job_hive.queue import RedisQueue
with HiveWork(queue=RedisQueue(
name="test",
host="your_redis_host",
password="your_password"
)) as work:
# 使用work 对象进行任务推送提交到任务池
jobs = [work.push(print, f"hello {i}") for i in range(5)]
for job in jobs:
print(job.status)
# 启动工作模式接收任务
work.work()
⚙️ 配置说明
from job_hive.queue import RedisQueue
RedisQueue(
name="队列名称", # 必填
host="localhost", # 默认localhost
port=6379, # 默认端口
password=None, # 密码(可选)
db=0 # 数据库编号,默认为0
)
🤝 贡献指南
- Fork本仓库
- 创建特性分支(git checkout -b feature/AmazingFeature)
- 提交修改(git commit -m 'Add some AmazingFeature')
- 推送分支(git push origin feature/AmazingFeature)
- 发起Pull Request
📄 许可证
MIT License
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
job_hive-0.1.3.tar.gz
(7.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
job_hive-0.1.3-py3-none-any.whl
(10.3 kB
view details)
File details
Details for the file job_hive-0.1.3.tar.gz.
File metadata
- Download URL: job_hive-0.1.3.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.10.16 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06d6d073325c54256e2821c8c1717b9165efa222307e4b1aba73a3072172cc9b
|
|
| MD5 |
6ee1ee651fbee9a4a4ae8cc95b5a9c00
|
|
| BLAKE2b-256 |
64ec61bfd4c52d796ad66375368d584315d20396e8490e7e6b4e172d5b932712
|
File details
Details for the file job_hive-0.1.3-py3-none-any.whl.
File metadata
- Download URL: job_hive-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.10.16 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7adf98cc1ffb5338cfd6121c9ec07ffaa67f5d33f5207ae9ab9884467ba0386
|
|
| MD5 |
f6d208e4bfaeccc4b13c19ee722b30a4
|
|
| BLAKE2b-256 |
c48b4bf8267b689b423d87b677fc74f8fc77758b52b1d84b672c6e8fc718e59b
|