dayhoff-tools 1.9.1__py3-none-any.whl → 1.9.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dayhoff_tools/cli/engine_commands.py +60 -19
- {dayhoff_tools-1.9.1.dist-info → dayhoff_tools-1.9.2.dist-info}/METADATA +1 -1
- {dayhoff_tools-1.9.1.dist-info → dayhoff_tools-1.9.2.dist-info}/RECORD +5 -5
- {dayhoff_tools-1.9.1.dist-info → dayhoff_tools-1.9.2.dist-info}/WHEEL +0 -0
- {dayhoff_tools-1.9.1.dist-info → dayhoff_tools-1.9.2.dist-info}/entry_points.txt +0 -0
@@ -319,9 +319,6 @@ def format_status(state: str, ready: Optional[bool]) -> str:
|
|
319
319
|
return state
|
320
320
|
|
321
321
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
322
|
def resolve_engine(name_or_id: str, engines: List[Dict]) -> Dict:
|
326
323
|
"""Resolve engine by name or ID with interactive selection."""
|
327
324
|
# Exact ID match
|
@@ -927,23 +924,55 @@ def engine_status(
|
|
927
924
|
if not content:
|
928
925
|
return None
|
929
926
|
data = json.loads(content)
|
930
|
-
# Convert last_state schema to idle_detector schema used by CLI output
|
927
|
+
# Convert last_state schema (new or old) to idle_detector schema used by CLI output
|
931
928
|
idle_info: Dict[str, Any] = {"available": True}
|
932
|
-
|
933
|
-
#
|
929
|
+
|
930
|
+
# Active/idle
|
931
|
+
idle_flag = bool(data.get("idle", False))
|
932
|
+
idle_info["status"] = "idle" if idle_flag else "active"
|
933
|
+
|
934
|
+
# Threshold and elapsed
|
934
935
|
if isinstance(data.get("timeout_sec"), (int, float)):
|
935
936
|
idle_info["idle_threshold"] = int(data["timeout_sec"]) # seconds
|
936
|
-
|
937
|
+
if isinstance(data.get("idle_seconds"), (int, float)):
|
938
|
+
idle_info["idle_seconds"] = int(data["idle_seconds"])
|
939
|
+
|
940
|
+
# Keep raw reasons for sensor display when available (new schema)
|
937
941
|
if isinstance(data.get("reasons"), list):
|
938
942
|
idle_info["_reasons_raw"] = data["reasons"]
|
939
|
-
|
940
|
-
|
943
|
+
else:
|
944
|
+
# Fallback: synthesize reasons from the old forensics layout
|
945
|
+
f_all = data.get("forensics", {}) or {}
|
946
|
+
synthesized = []
|
947
|
+
|
948
|
+
def _mk(sensor_name: str, key: str):
|
949
|
+
entry = f_all.get(key, {}) or {}
|
950
|
+
synthesized.append(
|
951
|
+
{
|
952
|
+
"sensor": sensor_name,
|
953
|
+
"active": bool(entry.get("active", False)),
|
954
|
+
"reason": entry.get("reason", ""),
|
955
|
+
"forensic": entry.get("forensic", {}),
|
956
|
+
}
|
957
|
+
)
|
958
|
+
|
959
|
+
_mk("CoffeeLockSensor", "coffee")
|
960
|
+
_mk("ActiveLoginSensor", "ssh")
|
961
|
+
_mk("IDEConnectionSensor", "ide")
|
962
|
+
_mk("DockerWorkloadSensor", "docker")
|
963
|
+
idle_info["_reasons_raw"] = synthesized
|
964
|
+
|
965
|
+
# Derive details from sensors
|
966
|
+
for r in idle_info.get("_reasons_raw", []):
|
941
967
|
if not r.get("active"):
|
942
968
|
continue
|
943
969
|
sensor = (r.get("sensor") or "").lower()
|
944
970
|
forensic = r.get("forensic") or {}
|
945
971
|
if sensor == "ideconnectionsensor":
|
946
|
-
|
972
|
+
# Prefer unique_pid_count written by new detector
|
973
|
+
cnt = forensic.get("unique_pid_count")
|
974
|
+
if not isinstance(cnt, int):
|
975
|
+
cnt = forensic.get("matches")
|
947
976
|
if isinstance(cnt, int):
|
948
977
|
idle_info["ide_connections"] = {"connection_count": cnt}
|
949
978
|
else:
|
@@ -955,12 +984,11 @@ def engine_status(
|
|
955
984
|
timedelta(seconds=int(rem))
|
956
985
|
)
|
957
986
|
elif sensor == "activeloginsensor":
|
958
|
-
# Provide a single summarized SSH session if available
|
959
987
|
sess = {
|
960
|
-
"tty":
|
961
|
-
"pid":
|
962
|
-
"idle_time":
|
963
|
-
"from_ip":
|
988
|
+
"tty": forensic.get("tty", "pts/?"),
|
989
|
+
"pid": forensic.get("pid", "?"),
|
990
|
+
"idle_time": forensic.get("idle_sec", 0),
|
991
|
+
"from_ip": forensic.get("remote_addr", "unknown"),
|
964
992
|
}
|
965
993
|
idle_info.setdefault("ssh_sessions", []).append(sess)
|
966
994
|
return idle_info
|
@@ -1002,7 +1030,23 @@ def engine_status(
|
|
1002
1030
|
status_lines.append(_sensor_line(" IDE ", "IDEConnectionSensor", "🖥"))
|
1003
1031
|
status_lines.append(_sensor_line("Docker", "DockerWorkloadSensor", "🐳"))
|
1004
1032
|
|
1005
|
-
|
1033
|
+
# If we have elapsed idle seconds and threshold, reflect that in the header
|
1034
|
+
try:
|
1035
|
+
if idle_detector.get("status") == "idle":
|
1036
|
+
idle_secs = int(idle_detector.get("idle_seconds", 0))
|
1037
|
+
thresh_secs = int(idle_detector.get("idle_threshold", 0))
|
1038
|
+
if thresh_secs > 0:
|
1039
|
+
active_disp = (
|
1040
|
+
f"[yellow]Idle {idle_secs//60}m/{thresh_secs//60}m[/yellow]"
|
1041
|
+
)
|
1042
|
+
# Rewrite top header line (index 0) to include updated display
|
1043
|
+
all_header = top_lines[0]
|
1044
|
+
# Replace the portion after two spaces (name and running state fixed)
|
1045
|
+
top_lines[0] = (
|
1046
|
+
f"[blue]{engine['name']}[/blue] {run_disp} {active_disp}\n"
|
1047
|
+
)
|
1048
|
+
except Exception:
|
1049
|
+
pass
|
1006
1050
|
|
1007
1051
|
# Combine top summary and details
|
1008
1052
|
all_lines = top_lines + status_lines
|
@@ -1041,9 +1085,6 @@ def engine_status(
|
|
1041
1085
|
console.print(f"[red]❌ Error fetching log: {e}[/red]")
|
1042
1086
|
|
1043
1087
|
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
1088
|
@engine_app.command("stop")
|
1048
1089
|
def stop_engine(
|
1049
1090
|
name_or_id: str = typer.Argument(help="Engine name or instance ID"),
|
@@ -3,7 +3,7 @@ dayhoff_tools/chemistry/standardizer.py,sha256=uMn7VwHnx02nc404eO6fRuS4rsl4dvSPf
|
|
3
3
|
dayhoff_tools/chemistry/utils.py,sha256=jt-7JgF-GeeVC421acX-bobKbLU_X94KNOW24p_P-_M,2257
|
4
4
|
dayhoff_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
dayhoff_tools/cli/cloud_commands.py,sha256=33qcWLmq-FwEXMdL3F0OHm-5Stlh2r65CldyEZgQ1no,40904
|
6
|
-
dayhoff_tools/cli/engine_commands.py,sha256=
|
6
|
+
dayhoff_tools/cli/engine_commands.py,sha256=MHwufx82Fv_2_b5Rw2RQlDlTwXXZ4cum3C3iWY8k1bg,106897
|
7
7
|
dayhoff_tools/cli/main.py,sha256=LoFs3SI4fdCjP4pdxEAhri-_q0dmNYupmBCRE4KbBac,5933
|
8
8
|
dayhoff_tools/cli/swarm_commands.py,sha256=5EyKj8yietvT5lfoz8Zx0iQvVaNgc3SJX1z2zQR6o6M,5614
|
9
9
|
dayhoff_tools/cli/utility_commands.py,sha256=WQTHOh1MttuxaJjl2c6zMa4x7_JuaKMQgcyotYrU3GA,25883
|
@@ -27,7 +27,7 @@ dayhoff_tools/intake/uniprot.py,sha256=BZYJQF63OtPcBBnQ7_P9gulxzJtqyorgyuDiPeOJq
|
|
27
27
|
dayhoff_tools/logs.py,sha256=DKdeP0k0kliRcilwvX0mUB2eipO5BdWUeHwh-VnsICs,838
|
28
28
|
dayhoff_tools/sqlite.py,sha256=jV55ikF8VpTfeQqqlHSbY8OgfyfHj8zgHNpZjBLos_E,18672
|
29
29
|
dayhoff_tools/warehouse.py,sha256=UETBtZD3r7WgvURqfGbyHlT7cxoiVq8isjzMuerKw8I,24475
|
30
|
-
dayhoff_tools-1.9.
|
31
|
-
dayhoff_tools-1.9.
|
32
|
-
dayhoff_tools-1.9.
|
33
|
-
dayhoff_tools-1.9.
|
30
|
+
dayhoff_tools-1.9.2.dist-info/METADATA,sha256=Da2zCfX4_gYuAGWdRhiBAivATAehMFCsyoXbZtp0dys,2914
|
31
|
+
dayhoff_tools-1.9.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
32
|
+
dayhoff_tools-1.9.2.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
|
33
|
+
dayhoff_tools-1.9.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|