Register task is exit.
Problem description
config = ExecutorConfig( xxl_admin_baseurl="http://xxxx.xxxx:8050/job-admin/", 公司java项目配置的也是这个地址 executor_app_name="python-executor-sample", executor_listen_host="我的ip", 与xxx.xxx 不在同一个网段,但通过本地连接vpn是可以通的 access_token="xxxxtoken", debug=True )
@app.register(name="demoJobHandler") async def test_task(): # you can get task params with "g" g.logger.info("get executor params: %s" % g.xxl_run_data.executorParams) for i in range(10): g.logger.warning("test logger %s" % i) await asyncio.sleep(5)
return "成功..."
以上是代码内容。配置已经在xxjobadmin页面上配置了执行器,名称与executor_app_name一致,也添加了任务,任务名demoJobHandler 代码记动后 显示 ======== Running on http://我本机ip:9999 ========
问题1. 脚本启动后 xxjobadmin上 执行器管理中 自动注册里 不能显示我本机ip 问题2.在py日志里显示 /lib/python3.9/site-packages/pyxxl/main.py(_register_task:89) - Register task is exit.
问题3 问题好像在 async def _post(self, path: str, payload: JsonType, retry_times: Optional[int] = None) -> Response: 这个方法中 if response.status == 200: r = Response(**(await response.json())) 这句出现的。
看了官网不支持2.1 ,看能不能支持一下。 环境
- XXL-JOB 版本:2.1
- pyxxl 版本:最新
- python 版本:3.9.24
- other more:
把日志中的报错相关信息发一下,我有空看下。这样不清楚哪里的问题
把日志中的报错相关信息发一下,我有空看下。这样马拉松哪里的问题 错误信息如下:
2025-11-07 10:02:28.563 [MainThread] DEBUG /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/setting.py(post_init:119) - init config: {'xxl_admin_baseurl': 'http://公司ip:8050/job-admin/', 'executor_app_name': 'python-xxl-job-executor-sample', 'access_token': 'opay-jobs-token', 'executor_url': 'http://xxxx:9999', 'executor_listen_port': 9999, 'executor_listen_host': 'xxxx', 'executor_log_path': 'pyxxl.log', 'executor_logger': <Logger pyxxl.executor (DEBUG)>, 'max_workers': 30, 'task_timeout': 600, 'task_queue_length': 30, 'graceful_close': False, 'graceful_timeout': 300, 'log_target': 'disk', 'log_local_dir': 'logs', 'log_redis_uri': '', 'log_expired_days': 14, 'log_clean_interval': 3600, 'http_retry_times': 3, 'http_retry_duration': 5, 'http_timeout': 30, 'dotenv_try': True, 'dotenv_path': None, 'debug': True} 2025-11-07 10:02:28.563 [MainThread] DEBUG /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/executor.py(func_wrapper:93) - register job demoJobHandler,is async: True 2025-11-07 10:02:28.564 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/main.py(_cleanup_ctx:142) - register with handlers ['<demoJobHandler is_async:True>'] 2025-11-07 10:02:28.564 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/main.py(server_info_ctx:33) - start executor server with pid 48954. 2025-11-07 10:02:28.564 [MainThread] DEBUG /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/logger/common.py(expired_loop:47) - start expired_loop... 2025-11-07 10:02:28.564 [pyxxl_pool_0] DEBUG /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/logger/disk.py(_scan_expired_files:109) - Start scan expired files 2025-11-07 10:02:28.564 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/xxl_client.py(registry:65) - 2222333 2025-11-07 10:02:28.564 [MainThread] DEBUG /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/xxl_client.py(_post:93) - post to xxl-job path=registry payload={'registryGroup': 'EXECUTOR', 'registryKey': 'python-xxl-job-executor-sample', 'registryValue': 'http://xxxx:9999'} 2025-11-07 10:02:28.564 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/xxl_client.py(_post:98) - /job-admin/registry 2025-11-07 10:02:28.565 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/logger/disk.py(expired_once:93) - Search expired logs, found 0 ======== Running on http://本机ip:9999 ======== (Press CTRL+C to quit) 2025-11-07 10:02:29.031 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/xxl_client.py(_post:103) - response.text 返回信息:<bound method ClientResponse.text ofentResponse(http://公司ip:8050/job-admin/toLogin) [200 None]> <CIMultiDictProxy('X-Application-Context': 'application:dev:8050', 'Content-Type': 'text/html;charset=UTF-8', 'Content-Language': 'en-US', 'Transfer-Encoding': 'chunked', 'Date': 'Fri, 07 Nov 2025 02:02:28 GMT')>
/opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/xxl_client.py:104: RuntimeWarning: coroutine 'ClientResponse.json' was never awaited self.logger.info(f"response.json()返回信息:{response.json()}") RuntimeWarning: Enable tracemalloc to get the object allocation traceback 2025-11-07 10:02:29.035 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/xxl_client.py(_post:104) - response.json()返回信息:<coroutine object ClientResponse.js 0x101fece40> 2025-11-07 10:02:29.484 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/main.py(_register_task:86) - 222222 2025-11-07 10:02:29.484 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/main.py(_register_task:87) - 200, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url='http://公司ip:8050/job-admin/toLogin' 2025-11-07 10:02:29.484 [MainThread] WARNING /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/main.py(_register_task:89) - Register task is exit.
2025-11-07 10:03:26.422 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/main.py(server_info_ctx:35) - stop executor server. pid=48954. 2025-11-07 10:03:26.423 [MainThread] DEBUG /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/xxl_client.py(_post:93) - post to xxl-job path=registryRemove payload={'registryGroup': 'EXECUTOR', 'registryKey': 'python-xxl-job-executor-sample', 'registryValue': 'http://本机ip:9999'} 2025-11-07 10:03:26.424 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/xxl_client.py(_post:98) - /job-admin/registryRemove 2025-11-07 10:03:26.424 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/logger/common.py(expired_loop:57) - expired_loop exit... 2025-11-07 10:03:26.888 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/xxl_client.py(_post:103) - response.text 返回信息:<bound method ClientResponse.text ofentResponse(http://公司ip:8050/job-admin/toLogin) [200 None]> <CIMultiDictProxy('X-Application-Context': 'application:dev:8050', 'Content-Type': 'text/html;charset=UTF-8', 'Content-Language': 'en-US', 'Transfer-Encoding': 'chunked', 'Date': 'Fri, 07 Nov 2025 02:03:26 GMT')>
2025-11-07 10:03:26.889 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/xxl_client.py(_post:104) - response.json()返回信息:<coroutine object ClientResponse.js 0x101fecf40> Traceback (most recent call last): File "/opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/aiohttp/web.py", line 423, in _run_app await asyncio.sleep(3600) File "/opt/anaconda3/envs/czy1028/lib/python3.9/asyncio/tasks.py", line 652, in sleep return await future asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/chengzhengyang/Desktop/opay_tools/xxjob_test/main.py", line 31, in
@yang957 看下是不是同一个问题,被重定向到登录页了 #52
2025-11-07 18:24:32.869 [MainThread] INFO /opt/anaconda3/envs/czy1028/lib/python3.9/site-packages/pyxxl/main.py(_register_task:87) - 200, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url='http://xxxx:8050/job-admin/toLogin'. 是被重定向到了这个地址。我使用这个地址在浏览器里登录 是失败的。我看上个问题里说 把xxl_admin_baseurl 地址换成 http://ip:prot/api/ 这种格式,我也试了,不行 运行后显示 Registry executor failed.
我这也遇到了相似的问题, 使用的 0.4.1 版本,baseurl 也是 /api/ 的格式,从容器日志里只看到 Register task is exit,然后 admin 调度日志显示执行器地址为空,但没有看到其他的错误日志
fixed by #89 #88