backend.ai
backend.ai copied to clipboard
refactor: Replace `sessions`, `kernels`'s `status_history`'s type `map` with `list`
Refs #412, follow-up to #480. Related issue: https://github.com/lablup/backend.ai/pull/1116.
The current implementation saves only the most recent timestamp whenever status information in status_history
is updated, and all previous information is deleted.
This PR prevents the loss of timestamp information by changing the data structure of sessions
, kernels
's status_history
to List.
Previous format:
{
"PENDING": "2024-01-01T00:00:05Z",
"SCHEDULED": "2024-01-01T00:00:10Z",
"PREPARING": "2024-01-01T00:00:12Z",
"RESTARTING": "2024-01-01T00:30:00Z",
"RUNNING": "2024-01-01T00:30:08Z", // overwritten if restarted
}
New format:
[
{"status": "PENDING", "timestamp": "2024-01-01T00:00:05Z"},
{"status": "SCHEDULED", "timestamp": "2024-01-01T00:00:05Z"},
{"status": "PREPARING", "timestamp": "2024-01-01T00:00:05Z"},
{"status": "RUNNING", "timestamp": "2024-01-01T00:00:15Z"}, // preserved
{"status": "RESTARTING", "timestamp": "2024-01-01T00:30:00Z"},
{"status": "RUNNING", "timestamp": "2024-01-01T00:30:08Z"},
]
Checklist: (if applicable)
- [x] Milestone metadata specifying the target backport version
- [x] API server-client counterparts (e.g., manager API -> client SDK)
📚 Documentation preview 📚: https://sorna--2113.org.readthedocs.build/en/2113/
📚 Documentation preview 📚: https://sorna-ko--2113.org.readthedocs.build/ko/2113/