Skip to main content

A Python executor for XXL-jobs

Project description

xxl-jobs 的python客户端实现

Package version Supported Python versions Coverage

使用pyxxl可以方便的把Python写的方法注册到xxl-job中,使用xxl-job-admin管理Python定时任务和周期任务

已经支持的功能

  • 执行器注册到job-admin
  • task注册,类似于flask路由装饰器的用法
  • 任务的管理(支持在界面上取消,发起等操作,任务完成后会回调admin)
  • 所有阻塞策略的支持
  • 异步支持(推荐)

待实现

  • 自定义日志 和 界面上查看日志

如何使用

pip install pyxxl
import asyncio

from pyxxl import PyxxlRunner

app = PyxxlRunner(
    "http://localhost:8080/xxl-job-admin/api/",
    executor_name="xxl-job-executor-sample",
    port=9999,
    host="172.17.0.1",
)

@app.handler.register(name="demoJobHandler")
async def test_task():
    await asyncio.sleep(5)
    return "成功..."


@app.handler.register(name="xxxxx")
async def test_task3():
    await asyncio.sleep(3)
    return "成功3"


app.run_executor()

更多示例和接口文档请参考 PYXXL文档 ,具体代码在example文件夹下面

开发人员

下面是开发人员如何快捷的搭建开发调试环境

启动xxl的调度中心

./init_dev_env.sh

启动执行器

poetry install
# 修改app.py中相关的配置信息,然后启动
poetry run python example/app.py

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

pyxxl-0.1.6.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

pyxxl-0.1.6-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file pyxxl-0.1.6.tar.gz.

File metadata

  • Download URL: pyxxl-0.1.6.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pyxxl-0.1.6.tar.gz
Algorithm Hash digest
SHA256 af4ac0108396a6cfc0af27fa6aef6ccfe9851e60bdc51985774f4fb7fb578e6e
MD5 9d2a81dfb33c8bf762ef2a90c5a4a02e
BLAKE2b-256 fac22d7cfcaea9b9199fc3825bcc818a797840d835d2aa80437e78eb0d382a3c

See more details on using hashes here.

Provenance

File details

Details for the file pyxxl-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pyxxl-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pyxxl-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b91da5aeec98bb574c894627202daf03dd8fcb4a6ac024af89c1d59d78712183
MD5 862d0e0c513ae474a8329df65a7e2d17
BLAKE2b-256 f2ce46fb9c2a5a905223cead90ddf8f200f5178b8bf69a0c3e795844093f4b77

See more details on using hashes here.

Provenance

Supported by

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