Skip to content

Commit

Permalink
Session get now supports multiple ids
Browse files Browse the repository at this point in the history
  • Loading branch information
AncientPatata committed Jan 23, 2025
1 parent ba4c347 commit 5967b6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/armonik_cli/commands/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,18 @@ def list(


@sessions.command(name="get")
@session_argument
@click.argument("session-ids", required=True, type=str, nargs=-1)
@base_command
def session_get(endpoint: str, output: str, session_id: str, debug: bool) -> None:
def session_get(endpoint: str, output: str, session_ids: List[str], debug: bool) -> None:
"""Get details of a given session."""
with grpc.insecure_channel(endpoint) as channel:
sessions_client = ArmoniKSessions(channel)
session = sessions_client.get_session(session_id=session_id)
session = _clean_up_status(session)
console.formatted_print(session, format=output, table_cols=SESSION_TABLE_COLS)
sessions = []
for session_id in session_ids:
session = sessions_client.get_session(session_id=session_id)
session = _clean_up_status(session)
sessions.append(session)
console.formatted_print(sessions, format=output, table_cols=SESSION_TABLE_COLS)


@sessions.command(name="create")
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_session_list(mocker, cmd):
def test_session_get(mocker, cmd):
mocker.patch.object(ArmoniKSessions, "get_session", return_value=deepcopy(raw_session))
result = run_cmd_and_assert_exit_code(cmd)
assert reformat_cmd_output(result.output, deserialize=True) == serialized_session
assert reformat_cmd_output(result.output, deserialize=True) == [serialized_session]


@pytest.mark.parametrize(
Expand Down

0 comments on commit 5967b6a

Please sign in to comment.