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

具体可以查看example文件夹下面的2个例子

import logging
import asyncio

from pyxxl import PyxxlRunner, JobHandler

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

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


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


runner = PyxxlRunner(
    "http://localhost:8080/xxl-job-admin/api/",
    executor_name="xxl-job-executor-sample",
    port=9999,
    host="172.17.0.1",
    handler=xxl_handler,
)
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.2-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyxxl-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9

File hashes

Hashes for pyxxl-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6a2adb3d5ac16d6ca401cb7188dc0bfe6f80076e4cb9cd2aa5a7e703d0deda48
MD5 e8d8b5a6fddfecfdfdaf5098908e8d64
BLAKE2b-256 60968cc89eff9fce218109aeb6c6b88bf9c0170a643965e6712a18e7dc2094b1

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