python 監控,python任務調度系統web_監聽調度系統定時執行任務python_websock

 2023-10-15 阅读 29 评论 0

摘要:由于調度系統的定時任務通過ws://10.200.9.183:2017/(ws:webservce服務0可以從瀏覽器的console控制臺獲取到。向webservice發送'first:koala',即可查詢到定時任務。import asyncioimport loggingfrom datetime import datetimepython 監控?from aiowebsocket.

由于調度系統的定時任務通過ws://10.200.9.183:2017/(ws:webservce服務0可以從瀏覽器的console控制臺獲取到。

向webservice發送'first:koala',即可查詢到定時任務。

import asyncio

import logging

from datetime import datetime

python 監控?from aiowebsocket.converses import AioWebSocket

async def startup(uri):

async with AioWebSocket(uri) as aws:

converse = aws.manipulator

# message = b'AioWebSocket - Async WebSocket Client'

#將message值設置為first:koala,即前端用來調用調度系統定時任務的語句。

python編譯器,message=b'first:koala'

while True:

#向websock發送定時任務的消息

await converse.send(message)

print('{time}-Client send: {message}'

.format(time=datetime.now().strftime('%Y-%m-%d %H:%M:%S'), message=message))

python中任務,#接收到websock定時任務的任務名稱

mes = await converse.receive()

print('{time}-Client receive: {rec}'

.format(time=datetime.now().strftime('%Y-%m-%d %H:%M:%S'), rec=mes))

if name == 'main':

#調度系統定時任務的websock地址

python高并發web框架,remote = 'ws://10.200.9.183:2017/'

try:

asyncio.get_event_loop().run_until_complete(startup(remote))

except KeyboardInterrupt as exc:

logging.info('Quit.')`

由于定時任務執行需要時間,故需要等待至少3分鐘后查看websocket返回結果

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/3/138194.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息