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
启动执行器
poetry install
# 修改app.py中相关的配置信息,然后启动
poetry run python example/app.py
TODOs
[x] 自定义查看日志函数
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.4.tar.gz
(22.6 kB
view details)
Built Distribution
pyxxl-0.1.4-py3-none-any.whl
(25.1 kB
view details)
File details
Details for the file pyxxl-0.1.4.tar.gz
.
File metadata
- Download URL: pyxxl-0.1.4.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e74598e4fc7655265f2508249d876e6eafb27e7c8983c7c23875e632b89e35b9 |
|
MD5 | 7f808ded7f04e9451394b37f5281248e |
|
BLAKE2b-256 | b6cc45db16beb0124924b68d44edc09a1d2ab39d0cfe7073997d9ce23cd97b64 |
File details
Details for the file pyxxl-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: pyxxl-0.1.4-py3-none-any.whl
- Upload date:
- Size: 25.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd2e047ca0f4cd0793569d6af3e85e09ad1d8f4c7d9832d6787431b3fd42f98e |
|
MD5 | 4c8ec1c64311fe43e3169f2ceb2dd9d0 |
|
BLAKE2b-256 | eb6f70b1c10439a8aade6b387ac310c39ee1be396af6ccde5710b9061bfad248 |