[split-upload 5/6] f2fd4fa backup via proxy

This commit is contained in:
Simon
2026-08-11 14:17:39 +08:00
parent 90ff78563a
commit 7e7cafb4a3
74 changed files with 9410 additions and 3 deletions
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
from neo4j import GraphDatabase
uri = "bolt://neo4j:7687"
user = "neo4j"
password = "Wecom@2026"
driver = GraphDatabase.driver(uri, auth=(user, password))
with driver.session() as session:
# 清除旧数据
session.run("MATCH (n) DETACH DELETE n")
# 添加测试数据
session.run("""
CREATE (i1:Issue {name: "打印机驱动安装", category: "硬件问题", uuid: "issue-001"})
CREATE (a1:Action {name: "打印机驱动安装步骤", description: "1. 打开控制面板 2. 添加打印机 3. 选择手动添加"})
CREATE (i1)-[:HAS_ACTION]->(a1)
""")
session.run("""
CREATE (i2:Issue {name: "网络连不上", category: "网络问题", uuid: "issue-002"})
CREATE (a2:Action {name: "网络诊断步骤", description: "1. 检查网线 2. 重启路由器 3. 检查IP配置"})
CREATE (i2)-[:HAS_ACTION]->(a2)
""")
session.run("""
CREATE (i3:Issue {name: "邮箱无法收发", category: "软件问题", uuid: "issue-003"})
CREATE (a3:Action {name: "邮箱故障排除", description: "1. 检查网络 2. 清除缓存 3. 重新登录"})
CREATE (i3)-[:HAS_ACTION]->(a3)
""")
# 验证
result = session.run("MATCH (i:Issue) RETURN i.uuid, i.name")
for record in result:
print(f"uuid: {record['i.uuid']}, name: {record['i.name']}")
driver.close()
print("Done!")
File diff suppressed because it is too large Load Diff
+67
View File
@@ -0,0 +1,67 @@
"""Split and upload large file to server via JumpServer base64 chunks."""
import base64
import hashlib
import os
import subprocess
import sys
import time
PYTHON = r"C:\Users\simon\.workbuddy\binaries\python\versions\3.13.12\python.exe"
JMS = r"C:\Users\simon\.workbuddy\skills\jumpserver-ops\scripts\jms_ops.py"
LOCAL_FILE = r"D:\资料\03-项目开发\wecom_it_smart_desk\deploy_agent_v8.tar.gz"
REMOTE_FILE = "/tmp/deploy_agent_v8.tar.gz"
CHUNK_SIZE = 12 * 1024 # 12KB raw -> ~16KB base64, safe for command line
def run_jms(*args, timeout=30):
cmd = [PYTHON, JMS] + list(args)
result = subprocess.run(cmd, capture_output=True, timeout=timeout)
out = result.stdout.decode('utf-8', errors='replace') if result.stdout else ''
err = result.stderr.decode('utf-8', errors='replace') if result.stderr else ''
return out + err
def main():
with open(LOCAL_FILE, "rb") as f:
data = f.read()
md5 = hashlib.md5(data).hexdigest()
total_chunks = (len(data) + CHUNK_SIZE - 1) // CHUNK_SIZE
print(f"File: {LOCAL_FILE}")
print(f"Size: {len(data)} bytes ({len(data)/1024/1024:.2f} MB)")
print(f"MD5: {md5}")
print(f"Chunks: {total_chunks} (chunk size: {CHUNK_SIZE} bytes)")
print()
# Clear remote file
print("Clearing remote file...")
run_jms("exec", "-c", f"rm -f {REMOTE_FILE}", "--cmd-timeout", "10")
# Upload chunks
for i in range(total_chunks):
chunk = data[i * CHUNK_SIZE : (i + 1) * CHUNK_SIZE]
b64 = base64.b64encode(chunk).decode("ascii")
cmd = f'echo -n "{b64}" | base64 -d >> {REMOTE_FILE}'
result = run_jms("exec", "-c", cmd, "--cmd-timeout", "15")
if (i + 1) % 20 == 0 or i == total_chunks - 1:
print(f" Uploaded chunk {i + 1}/{total_chunks} ({(i + 1) * 100 // total_chunks}%)")
# Check for errors
if "error" in result.lower() and "traceback" not in result.lower():
# jms_ops.py always prints some status, check if the command actually failed
pass
# Verify MD5
print("\nVerifying MD5...")
result = run_jms("exec", "-c", f"md5sum {REMOTE_FILE}", "--cmd-timeout", "15")
print(f" Remote MD5: {result.strip()}")
print(f" Local MD5: {md5}")
if md5 in result:
print("\n✅ MD5 verified - upload successful!")
else:
print("\n❌ MD5 mismatch - upload may be corrupted!")
sys.exit(1)
if __name__ == "__main__":
main()
+14
View File
@@ -0,0 +1,14 @@
import sys, json
d = json.load(sys.stdin)
nodes = d.get('graph', {}).get('nodes', [])
llms = [n for n in nodes if n.get('data', {}).get('type') == 'llm']
print(f'Total LLM nodes: {len(llms)}')
for n in llms:
title = n['data']['title']
sys_prompt = [p for p in n['data'].get('prompt_template', []) if p.get('role') == 'system']
if sys_prompt:
text = sys_prompt[0].get('text', '')
print(f' {title}: sys_prompt_len={len(text)}, contains_json={"JSON" in text or "json" in text}')
else:
print(f' {title}: NO system prompt')