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.INFO)
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
启动执行器
poetry install
# 修改app.py中相关的配置信息,然后启动
poetry run python example/app.py
TODOs
[x] 自定义查看日志函数
[x] docs
Project details
Release history Release notifications | RSS feed
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.5.tar.gz
(24.7 kB
view details)
Built Distribution
pyxxl-0.1.5-py3-none-any.whl
(28.2 kB
view details)
File details
Details for the file pyxxl-0.1.5.tar.gz
.
File metadata
- Download URL: pyxxl-0.1.5.tar.gz
- Upload date:
- Size: 24.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24c608c5a98f080cc69096831c61284eb6633100e948574a37f90e18ff6e0fbe |
|
MD5 | ed9c1c1475b992ffee7a255b040678af |
|
BLAKE2b-256 | 1819c2de0ade29e9336e151bb52c59dcf2321797614b20cee62767cf85d39dcd |
File details
Details for the file pyxxl-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: pyxxl-0.1.5-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71f0659a5b4d2be3e7d7383c008449a35188f1eac88b9af756a7444429a62a78 |
|
MD5 | d1380dcc20888e3f6bda56841e3477f0 |
|
BLAKE2b-256 | 11bd437858c300dfd7b59abe881abc1c1283988189cf3185bf4f3c7508748355 |