在前后端开发联调前 的提交20260223
This commit is contained in:
23
scripts/ops/_fetch_logs.py
Normal file
23
scripts/ops/_fetch_logs.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""获取指定 execution_id 的完整日志。"""
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import requests
|
||||
|
||||
TOKEN = Path(__file__).parent.joinpath(".monitor_token").read_text().strip()
|
||||
BASE = "http://localhost:8000"
|
||||
HEADERS = {"Authorization": f"Bearer {TOKEN}"}
|
||||
|
||||
execution_id = "e21e1935-5abf-434f-9984-69c492402db7"
|
||||
|
||||
resp = requests.get(f"{BASE}/api/execution/{execution_id}/logs", headers=HEADERS, timeout=30)
|
||||
print(f"status_code={resp.status_code}")
|
||||
data = resp.json()
|
||||
print(f"output_log length: {len(data.get('output_log') or '')}")
|
||||
print(f"error_log length: {len(data.get('error_log') or '')}")
|
||||
print("--- output_log ---")
|
||||
print(data.get("output_log") or "(empty)")
|
||||
print("--- error_log ---")
|
||||
print(data.get("error_log") or "(empty)")
|
||||
Reference in New Issue
Block a user