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

Commit

Permalink
feature(cli): Add more details to admin queries (#147)
Browse files Browse the repository at this point in the history
* live_stat is added to the session queries.
* allow_docker_registries is added to the domain queries.
  • Loading branch information
achimnol committed Dec 2, 2020
1 parent 0be057d commit 0d8adfb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions changes/147.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add more detail fields (`live_stat` and `allowed_docker_registries`) to admin session/domain query CLI commands
2 changes: 2 additions & 0 deletions src/ai/backend/client/cli/admin/domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def domain(name):
('Created At', 'created_at'),
('Total Resource Slots', 'total_resource_slots'),
('Allowed vFolder Hosts', 'allowed_vfolder_hosts'),
('Allowed Docker Registries', 'allowed_docker_registries'),
('Scaling Groups', 'scaling_groups'),
]
with Session() as session:
Expand Down Expand Up @@ -56,6 +57,7 @@ def domains(ctx):
('Created At', 'created_at'),
('Total Resource Slots', 'total_resource_slots'),
('Allowed vFolder Hosts', 'allowed_vfolder_hosts'),
('Allowed Docker Registries', 'allowed_docker_registries'),
('Scaling Groups', 'scaling_groups'),
]
with Session() as session:
Expand Down
7 changes: 5 additions & 2 deletions src/ai/backend/client/cli/admin/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ def format_containers(containers: Sequence[Mapping[str, Any]], indent='') -> str
for cinfo in containers:
text += "\n".join((
f"+ {cinfo['id']}",
*(f" - {k + ': ':18s}{v}" for k, v in cinfo.items() if k not in ('id', 'last_stat')),
*(f" - {k + ': ':18s}{v}"
for k, v in cinfo.items()
if k not in ('id', 'live_stat', 'last_stat')),
f" + live_stat: {format_stats(cinfo['live_stat'], indent=' ')}",
f" + last_stat: {format_stats(cinfo['last_stat'], indent=' ')}",
))
return "\n" + textwrap.indent(text, indent)
Expand Down Expand Up @@ -269,7 +272,7 @@ def session(id_or_name):
fields.append((
'Containers',
'containers {'
' id role agent status status_info status_changed occupied_slots last_stat '
' id role agent status status_info status_changed occupied_slots last_stat live_stat '
'}',
))
fields.append((
Expand Down

0 comments on commit 0d8adfb

Please sign in to comment.