Skip to main content

一个极简的分布式任务模块

Project description

Job Hive

PyPI version

基于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
)

🤝 贡献指南

  1. Fork本仓库
  2. 创建特性分支(git checkout -b feature/AmazingFeature)
  3. 提交修改(git commit -m 'Add some AmazingFeature')
  4. 推送分支(git push origin feature/AmazingFeature)
  5. 发起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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

job_hive-0.1.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

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

Hashes for job_hive-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3085ad60a1856a2a751d3b40197640735e4e42da53f7606f95bcd0e333fe2529
MD5 66239b9e5867467ca3f6969fbca8c3a4
BLAKE2b-256 448cd01f302a2d4d6c060ac3b95b90b424d228c9b3eacbdc3e961922943e5c62

See more details on using hashes here.

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

Hashes for job_hive-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6f3b981d9fcd17c06fcec82880a3f77eb8596063da7dbdaa119c7a2e6aa73dc5
MD5 0a09a7f233282263f7defa99cb2c4970
BLAKE2b-256 ffa8264fac053f934b9214e9dd1e0bc67b752f1ece5ac011396fc7f6fac47f48

See more details on using hashes here.

Supported by

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