Skip to content

Commit 4fff537

Browse files
authored
status: check connections (#557)
1 parent aeb81eb commit 4fff537

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/warnet/network.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def copy_scenario_defaults(directory: Path):
6363
)
6464

6565

66-
def _connected():
66+
def _connected(end="\n"):
6767
tanks = get_mission("tank")
6868
for tank in tanks:
6969
# Get actual
@@ -73,11 +73,11 @@ def _connected():
7373
if peer["connection_type"] == "manual":
7474
actual += 1
7575
expected = int(tank.metadata.annotations["init_peers"])
76-
print(f"Tank {tank.metadata.name} peers expected: {expected}, actual: {actual}")
76+
print(f"Tank {tank.metadata.name} peers expected: {expected}, actual: {actual}", end=end)
7777
# Even if more edges are specified, bitcoind only allows
7878
# 8 manual outbound connections
7979
if min(8, expected) > actual:
80-
print("Network not connected")
80+
print("\nNetwork not connected")
8181
return False
82-
print("Network connected")
82+
print("Network connected ")
8383
return True

src/warnet/status.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from rich.text import Text
66

77
from .k8s import get_mission
8+
from .network import _connected
89

910

1011
@click.command()
@@ -53,6 +54,7 @@ def status():
5354
summary.append(f"\nTotal Tanks: {len(tanks)}", style="bold cyan")
5455
summary.append(f" | Active Scenarios: {len(scenarios)}", style="bold green")
5556
console.print(summary)
57+
_connected(end="\r")
5658

5759

5860
def _get_tank_status():

0 commit comments

Comments
 (0)