一个极简的分布式任务模块
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.1.tar.gz
(5.6 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.1.tar.gz.
File metadata
- Download URL: job_hive-0.1.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.10.16 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3085ad60a1856a2a751d3b40197640735e4e42da53f7606f95bcd0e333fe2529
|
|
| MD5 |
66239b9e5867467ca3f6969fbca8c3a4
|
|
| BLAKE2b-256 |
448cd01f302a2d4d6c060ac3b95b90b424d228c9b3eacbdc3e961922943e5c62
|
File details
Details for the file job_hive-0.1.1-py3-none-any.whl.
File metadata
- Download URL: job_hive-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.10.16 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f3b981d9fcd17c06fcec82880a3f77eb8596063da7dbdaa119c7a2e6aa73dc5
|
|
| MD5 |
0a09a7f233282263f7defa99cb2c4970
|
|
| BLAKE2b-256 |
ffa8264fac053f934b9214e9dd1e0bc67b752f1ece5ac011396fc7f6fac47f48
|