-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11Untitled-2.py.bak
More file actions
67 lines (55 loc) · 1.56 KB
/
Copy path11Untitled-2.py.bak
File metadata and controls
67 lines (55 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""
LEGION RAY LIVE PROBE
=====================
Purpose:
Attach to the already-running Legion Ray cluster and interrogate the live
SwarmKnowledgeRegistry actor without rebuilding anything.
Based on your existing dump:
- ray.init(address="auto", namespace="legion") works
- live named actor: SwarmKnowledgeRegistry
- known good method: get_registered_tables_summary
- Ray State API filter key should be ray_namespace, not namespace
Run from the machine where Ray is already running:
python legion_ray_live_probe.py
Optional:
python legion_ray_live_probe.py --actor SwarmKnowledgeRegistry --namespace legion
"""
from __future__ import annotations
import argparse
import json
import sys
import traceback
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List
def safe_json(obj: Any) -> str:
try:
return json.dumps(obj, indent=2, default=str)
except Exception:
return repr(obj)
def call_actor_method(
actor,
method_name: str,
*args,
timeout_s: float = 20,
**kwargs,
) -> Dict[str, Any]:
import ray
try:
method = getattr(actor, method_name)
except Exception as e:
return {
"method": method_name,
"ok": False,
"error": f"missing method: {type(e).__name__}: {e}",
}
try:
ref = method.remote(*args, **kwargs)
value = ray.get(ref, timeout=timeout_s)
return {
"method": method_name,
"ok": True,
"value": value,
}
except Exception as e:
return {