Skip to main content

A Python executor for XXL-jobs

Project description

xxl-jobs 的python客户端实现

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

如何使用

pip install pyxxl
import logging
import asyncio

from pyxxl import run_executor, job_hander

logger = logging.getLogger("pyxxl")
logger.setLevel(logging.DEBUG)


@job_hander
async def test_task():
    await asyncio.sleep(30)
    return "成功30"


@job_hander(name="xxxxx")
@xxxxx # 自己定义的装饰器必须放在下面
async def abc():
    await asyncio.sleep(3)
    return "成功3"


runner = PyxxlRunner(
    "http://localhost:8080/xxl-job-admin/api/",
    "test",
    port=9999,
    host="172.17.0.1",
)
runner.run_executor()

开发人员

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

启动xxl的调度中心

./init_dev_env.sh

启动执行器

python run.py

TODOs

  • [x] 自定义查看日志函数

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyxxl-0.1.1-py3-none-any.whl (22.4 kB view hashes)

Uploaded Python 3

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