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

Commit 7bb98cf

Browse files
authored
fix: desync of "info" command alias to "admin session" (#162)
* setup: Update mypy and type annotation pkgs
1 parent b0df6da commit 7bb98cf

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

changes/162.fix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix desynchronized parameters of the `info` command alias of the `admin session` command

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
'flake8>=3.8.4',
4444
]
4545
typecheck_requires = [
46-
'mypy>=0.812',
46+
'mypy>=0.901',
47+
'types-click',
48+
'types-python-dateutil',
49+
'types-tabulate',
4750
]
4851
dev_requires: List[str] = [
4952
# 'pytest-sugar>=0.9.1',

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ def format_dependencies(dependencies: Sequence[Mapping[str, Any]], indent='') ->
218218

219219

220220
@admin.command()
221-
@click.argument('id_or_name', metavar='ID_OR_NAME')
222-
def session(id_or_name):
221+
@click.argument('session_id', metavar='SESSID')
222+
def session(session_id):
223223
'''
224224
Show detailed information for a running compute session.
225225
'''
@@ -257,7 +257,7 @@ def session(id_or_name):
257257
q = 'query($name: String!) {' \
258258
' compute_session(sess_id: $name) { $fields }' \
259259
'}'
260-
v = {'name': id_or_name}
260+
v = {'name': session_id}
261261
else:
262262
# In API v5 or later, we can query any compute session both in the history
263263
# and currently running using its UUID.
@@ -289,11 +289,11 @@ def session(id_or_name):
289289
' }' \
290290
'}'
291291
try:
292-
uuid.UUID(id_or_name)
292+
uuid.UUID(session_id)
293293
except ValueError:
294294
print_fail("In API v5 or later, the session ID must be given in the UUID format.")
295295
sys.exit(1)
296-
v = {'id': id_or_name}
296+
v = {'id': session_id}
297297
q = q.replace('$fields', ' '.join(item[1] for item in fields))
298298
try:
299299
resp = session_.Admin.query(q, v)

src/ai/backend/client/cli/run.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,11 +1177,9 @@ def restart(session_names):
11771177

11781178

11791179
@main.command()
1180-
@click.argument('session_name', metavar='NAME')
1181-
@click.option('-o', '--owner', '--owner-access-key', 'owner_access_key', metavar='ACCESS_KEY',
1182-
help='Specify the owner of the target session explicitly.')
1180+
@click.argument('session_id', metavar='SESSID')
11831181
@click.pass_context
1184-
def info(ctx, session_name, owner_access_key):
1182+
def info(ctx, session_id):
11851183
"""
11861184
Show detailed information for a running compute session.
11871185
This is an alias of the "admin session <sess_id>" command.

0 commit comments

Comments
 (0)