Skip to content

Commit

Permalink
little change on 'determine_and_set_status()'
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa committed Jun 18, 2024
1 parent f1e0636 commit 1c1e3cf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ai/backend/manager/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,20 +756,20 @@ def determine_and_set_status(
status_info: str | None = None,
status_data: Mapping[str, Any] | JSONCoalesceExpr | None = None,
status_changed_at: datetime | None = None,
) -> tuple[SessionStatus, bool]:
) -> bool:
"""
Determine the current status of a session based on its sibling kernels.
If it is possible to transit from the current status to the determined status, set status.
Else, do nothing.
Return the determined status of session and a boolean value meaning transition happened or not.
Return a boolean value meaning any transition happened or not.
"""

determined_status = determine_session_status(self.kernels)
if determined_status not in SESSION_STATUS_TRANSITION_MAP[self.status]:
return determined_status, False
return False

self.set_status(determined_status, status_info, status_data, status_changed_at)
return determined_status, True
return True

def set_status(
self,
Expand Down

0 comments on commit 1c1e3cf

Please sign in to comment.