You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's allow users to query when their sessions and kernels enteres which status.
(e.g., when did this session move from PENDING to SCHEDULED, PREPARING to RUNNING, etc. afterwards)
Fortunately, there is no backward status transition in the kernel's lifecycle.
(e.g., PENDING -> SCHEDULED exists but SCHEDULED -> PENDING does not exist)
So we could use a simple JSONB column whose keys are the status names and their values are the timestamps when the row's status is set as the key.
{"PENDING": "...",// would be same to created_at"SCHEDULED": "...","PREPARING": "...","RUNNING": "...",// ..."TERMINATED": "...",// would be same to terminated_at}
When the key does not exist or null, it means either the kernel has not been gone into that status or the record is a migrated one from older versions.
Let's use manager.models.utils.sql_json_merge() to incrementally add a new key as follows:
achimnol
changed the title
Add status_history JSONB column to track the datetimes for each status change
Add kernsl.status_history JSONB column to track the datetimes for each status change
Apr 8, 2022
achimnol
changed the title
Add kernsl.status_history JSONB column to track the datetimes for each status change
Add kernels.status_history JSONB column to track the datetimes for each status change
Apr 8, 2022
Let's allow users to query when their sessions and kernels enteres which status.
(e.g., when did this session move from PENDING to SCHEDULED, PREPARING to RUNNING, etc. afterwards)
Fortunately, there is no backward status transition in the kernel's lifecycle.
(e.g., PENDING -> SCHEDULED exists but SCHEDULED -> PENDING does not exist)
So we could use a simple JSONB column whose keys are the status names and their values are the timestamps when the row's status is set as the key.
When the key does not exist or null, it means either the kernel has not been gone into that status or the record is a migrated one from older versions.
Let's use
manager.models.utils.sql_json_merge()
to incrementally add a new key as follows:For maximum interoperability, the timestamp values could be formatted as UTC-based ISO8601 datetime.
Q. How could we "ensure" all database status change queries to update this json field altogether?
The text was updated successfully, but these errors were encountered: