由于調度系統的定時任務通過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返回結果
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态