backend.ai
backend.ai copied to clipboard
feat: `session status-history` handler
refs #412, follow-up to #480
Currently, session status-history raises 404 error because the status-history handler does not exist.
$ ./backend.ai session status-history mysession
✘ BackendAPIError: 404 Not Found
Unknown URL path.
➜ Data: '/session/mysession/status-history'
Result
In this PR, session status-history command prints the status-history like below.
$ ./backend.ai session status-history mysession
∙ status_history: OrderedDict([('PENDING', '2023-02-27T00:48:12.723794+00:00'), ('RUNNING', '2023-02-27T00:48:18.579231+00:00'), ('PREPARING', '2023-02-27T00:48:13.530317+00:00'), ('SCHEDULED', '2023-02-27T00:48:13.498186+00:00')])
✓ Actual Resource Allocation Time: {'result': {'seconds': 0, 'microseconds': 0}}
But I think it would be nice to find better formatting for the status-history instead of just printing OrderedDict.
Please refer ai.backend.client.output and its usage for handling console/json outputs of the client SDK in a single abstraction.
Please refer ai.backend.client.output and its usage for handling console/json outputs of the client SDK in a single abstraction.
I updated this PR, but I think there might be some missing session types in https://github.com/lablup/backend.ai/pull/1116/files#diff-617867996601b356e12de71696162ef8390144f3ba6aaba12da78cb7efabf4f7R961-R969.
We will revisit this PR after converting the status history columns from mappings to lists in the chronological order.
This will be resolved in #3201.