Skip to content

Commit 5c99682

Browse files
committed
add binary to status
1 parent effe95d commit 5c99682

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/warnet/status.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def status():
1515

1616
tanks = _get_tank_status()
1717
scenarios = _get_deployed_scenarios()
18+
binaries = _get_active_binaries()
1819

1920
# Create a unified table
2021
table = Table(title="Warnet Status", show_header=True, header_style="bold magenta")
@@ -40,6 +41,20 @@ def status():
4041
else:
4142
table.add_row("Scenario", "No active scenarios", "")
4243

44+
# Add a separator if there are both tanks or scenarios and binaries
45+
if (tanks or scenarios) and binaries:
46+
table.add_row("", "", "")
47+
48+
# Add binaries to the table
49+
active_binaries = 0
50+
if binaries:
51+
for binary in binaries:
52+
table.add_row("Binary", binary["name"], binary["status"])
53+
if binary["status"] == "running" or binary["status"] == "pending":
54+
active_binaries += 1
55+
else:
56+
table.add_row("Binaries", "No active binaries", "")
57+
4358
# Create a panel to wrap the table
4459
panel = Panel(
4560
table,
@@ -56,6 +71,7 @@ def status():
5671
summary = Text()
5772
summary.append(f"\nTotal Tanks: {len(tanks)}", style="bold cyan")
5873
summary.append(f" | Active Scenarios: {active}", style="bold green")
74+
summary.append(f" | Active Binaries: {active_binaries}", style="bold red")
5975
console.print(summary)
6076
_connected(end="\r")
6177

@@ -68,3 +84,8 @@ def _get_tank_status():
6884
def _get_deployed_scenarios():
6985
commanders = get_mission("commander")
7086
return [{"name": c.metadata.name, "status": c.status.phase.lower()} for c in commanders]
87+
88+
89+
def _get_active_binaries():
90+
binaries = get_mission("binary")
91+
return [{"name": b.metadata.name, "status": b.status.phase.lower()} for b in binaries]

0 commit comments

Comments
 (0)