一个极简的分布式任务模块
Project description
Job Hive
基于Redis实现的轻量级分布式任务队列系统
🚀 功能特性
- 支持任务推送、执行生命周期管理
- 提供Redis队列实现(支持密码认证)
- 上下文管理器简化资源管理
- 支持任务批处理(示例中含单任务推送)
📦 安装依赖
目前仅支持Python3.10+,且目前只支持Redis队列实现
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.2.tar.gz
(6.3 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
File details
Details for the file job_hive-0.1.2.tar.gz.
File metadata
- Download URL: job_hive-0.1.2.tar.gz
- Upload date:
- Size: 6.3 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 |
7af8e6185431b196373612e81e81f469acc223a6189f05fdcd0944684139f5a8
|
|
| MD5 |
03768b80b29c9494ded0062282dfb66c
|
|
| BLAKE2b-256 |
45273d10adbbb17c661a8083b9005629eb21d251740272ac438adc7aba632a54
|
File details
Details for the file job_hive-0.1.2-py3-none-any.whl.
File metadata
- Download URL: job_hive-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.8 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 |
f29cea8ebfeb7705200764ae1613576e27713e53722ac4fc2670ad83c1316718
|
|
| MD5 |
7d0f0f5db1a706d6e4f2b125059376f5
|
|
| BLAKE2b-256 |
12195c21f4a8fb3399c941931c9c1ada1291d42ea86060d7400578b3a1edc2c7
|