Skip to content

Commit 6263318

Browse files
more pio cli stuff
1 parent 4b6bf5a commit 6263318

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

core/pioreactor/cluster_management/__init__.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,27 @@ def display_data_for(worker: dict[str, str]) -> str:
347347

348348
ip, state, reachable, version, experiment = get_metadata(hostname)
349349

350-
statef = click.style(f"{state:15s}", fg="green" if state in ("ready", "init") else "red")
350+
state_lower = state.lower()
351+
if state_lower in ("ready", "init"):
352+
state_color = "green"
353+
elif state_lower.startswith("unknown"):
354+
state_color = "yellow"
355+
else:
356+
state_color = "red"
357+
statef = click.style(f"{state:15s}", fg=state_color, bold=True)
351358
ipf = f"{ip if (ip is not None) else 'unknown':20s}"
352359

353-
is_leaderf = f"{('Y' if hostname == leader_hostname else 'N'):15s}"
360+
is_leader_value = "Y" if hostname == leader_hostname else "N"
361+
is_leader_color = "green" if is_leader_value == "Y" else "red"
362+
is_leaderf = click.style(f"{is_leader_value:15s}", fg=is_leader_color, bold=True)
354363
hostnamef = f"{hostname:20s}"
355-
reachablef = f"{(click.style('Y', fg='green') if reachable else click.style('N', fg='red')):23s}"
364+
reachable_value = "Y" if reachable else "N"
365+
reachable_color = "green" if reachable else "red"
366+
reachablef = click.style(f"{reachable_value:14s}", fg=reachable_color, bold=True)
356367
versionf = f"{version:15s}"
357-
is_activef = f"{(click.style('Y', fg='green') if is_active else click.style('N', fg='red')):24s}"
368+
is_active_value = "Y" if is_active else "N"
369+
is_active_color = "green" if is_active else "red"
370+
is_activef = click.style(f"{is_active_value:15s}", fg=is_active_color, bold=True)
358371
experimentf = f"{experiment:15s}"
359372

360373
return f"{hostnamef} {is_leaderf} {ipf} {statef} {is_activef} {reachablef} {versionf} {experimentf}"

0 commit comments

Comments
 (0)