Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit 4284d1b

Browse files
committed
feature(cli): Add more details to admin queries (#147)
* live_stat is added to the session queries. * allow_docker_registries is added to the domain queries. Backported-From: 20.03 Backported-To: master
1 parent 1f29e2f commit 4284d1b

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

changes/147.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add more detail fields (`live_stat` and `allowed_docker_registries`) to admin session/domain query CLI commands

src/ai/backend/client/cli/admin/domains.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def domain(name):
2424
('Created At', 'created_at'),
2525
('Total Resource Slots', 'total_resource_slots'),
2626
('Allowed vFolder Hosts', 'allowed_vfolder_hosts'),
27+
('Allowed Docker Registries', 'allowed_docker_registries'),
2728
('Scaling Groups', 'scaling_groups'),
2829
]
2930
with Session() as session:
@@ -56,6 +57,7 @@ def domains(ctx):
5657
('Created At', 'created_at'),
5758
('Total Resource Slots', 'total_resource_slots'),
5859
('Allowed vFolder Hosts', 'allowed_vfolder_hosts'),
60+
('Allowed Docker Registries', 'allowed_docker_registries'),
5961
('Scaling Groups', 'scaling_groups'),
6062
]
6163
with Session() as session:

src/ai/backend/client/cli/admin/sessions.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ def format_containers(containers: Sequence[Mapping[str, Any]], indent='') -> str
200200
for cinfo in containers:
201201
text += "\n".join((
202202
f"+ {cinfo['id']}",
203-
*(f" - {k + ': ':18s}{v}" for k, v in cinfo.items() if k not in ('id', 'last_stat')),
203+
*(f" - {k + ': ':18s}{v}"
204+
for k, v in cinfo.items()
205+
if k not in ('id', 'live_stat', 'last_stat')),
206+
f" + live_stat: {format_stats(cinfo['live_stat'], indent=' ')}",
204207
f" + last_stat: {format_stats(cinfo['last_stat'], indent=' ')}",
205208
)) + "\n"
206209
return "\n" + textwrap.indent(text, indent)
@@ -268,14 +271,16 @@ def session(id_or_name):
268271
'Containers',
269272
'containers {'
270273
' id cluster_role cluster_idx cluster_hostname '
271-
' agent status status_info status_changed occupied_slots last_stat '
274+
' agent status status_info status_changed '
275+
' occupied_slots live_stat last_stat '
272276
'}',
273277
))
274278
else:
275279
fields.append((
276280
'Containers',
277281
'containers {'
278-
' id role agent status status_info status_changed occupied_slots last_stat '
282+
' id role agent status status_info status_changed '
283+
' occupied_slots live_stat last_stat '
279284
'}',
280285
))
281286
fields.append((

0 commit comments

Comments
 (0)