Skip to content

Commit

Permalink
feat: Add RPC and statuses for session lifecycle management
Browse files Browse the repository at this point in the history
  • Loading branch information
aneojgurhem committed Jan 10, 2024
1 parent 2390f92 commit 85d6344
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Protos/V1/session_status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ enum SessionStatus {
SESSION_STATUS_UNSPECIFIED = 0; /** Session is in an unknown state. */
SESSION_STATUS_RUNNING = 1; /** Session is open and accepting tasks for execution. */
SESSION_STATUS_CANCELLED = 2; /** Session is cancelled. No more tasks can be submitted and no more tasks will be executed. */
SESSION_STATUS_PAUSED = 3; /** Session is paused. Tasks can be submitted but no more new tasks will be executed. Already running tasks will continue until they finish. */
SESSION_STATUS_CLOSED = 4; /** Session is closed. No more tasks can be submitted and executed. Results data will be deleted. */
SESSION_STATUS_DELETED = 5; /** Session is deleted. Sessions, tasks and results metadata associated to the session will be deleted. */
SESSION_STATUS_END_OF_SUBMISSION = 6; /** Client cannot submit new tasks in the session. Tasks can still submit other tasks. */
}
80 changes: 80 additions & 0 deletions Protos/V1/sessions_common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,83 @@ message CreateSessionRequest {
message CreateSessionReply {
string session_id = 1; /** Session id of the created session if successful */
}

/**
* Request for pausing a single session.
*/
message PauseSessionRequest {
string session_id = 1; /** The session ID. */
}

/**
* Response for pausing a single session.
*
* Return a raw session.
*/
message PauseSessionResponse {
SessionRaw session = 1; /** The session. */
}

/**
* Request for resuming a single session.
*/
message ResumeSessionRequest {
string session_id = 1; /** The session ID. */
}

/**
* Response for resuming a single session.
*
* Return a raw session.
*/
message ResumeSessionResponse {
SessionRaw session = 1; /** The session. */
}

/**
* Request for terminating a single session.
*/
message TerminateSessionRequest {
string session_id = 1; /** The session ID. */
}

/**
* Response for terminating a single session.
*
* Return a raw session.
*/
message TerminateSessionResponse {
SessionRaw session = 1; /** The session. */
}

/**
* Request for closing a single session.
*/
message CloseSessionRequest {
string session_id = 1; /** The session ID. */
}

/**
* Response for closing a single session.
*
* Return a raw session.
*/
message CloseSessionResponse {
SessionRaw session = 1; /** The session. */
}

/**
* Request for deleting a single session.
*/
message DeleteSessionRequest {
string session_id = 1; /** The session ID. */
}

/**
* Response for deleting a single session.
*
* Return a raw session.
*/
message DeleteSessionResponse {
SessionRaw session = 1; /** The session. */
}
25 changes: 25 additions & 0 deletions Protos/V1/sessions_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,29 @@ service Sessions {
* Create a session
*/
rpc CreateSession(CreateSessionRequest) returns (CreateSessionReply);

/**
* Pause a session by its id.
*/
rpc PauseSession(PauseSessionRequest) returns (PauseSessionResponse);

/**
* Resume a paused session by its id.
*/
rpc ResumeSession(ResumeSessionRequest) returns (ResumeSessionResponse);

/**
* Terminate a session by its id. Client will not be able to submit new tasks.
*/
rpc TerminateSession(TerminateSessionRequest) returns (TerminateSessionResponse);

/**
* Close a session by its id. Removes Results data.
*/
rpc CloseSession(CloseSessionRequest) returns (CloseSessionResponse);

/**
* Delete a session by its id. Removes metadata from Results, Sessions and Tasks associated to the session.
*/
rpc DeleteSession(DeleteSessionRequest) returns (DeleteSessionResponse);
}

0 comments on commit 85d6344

Please sign in to comment.