Skip to content

Commit

Permalink
feat: simplify session submission management
Browse files Browse the repository at this point in the history
  • Loading branch information
aneojgurhem committed Jan 11, 2024
1 parent 028404b commit e38b6ae
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 75 deletions.
5 changes: 2 additions & 3 deletions Protos/V1/session_status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ enum SessionStatus {
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. */
SESSION_STATUS_PURGED = 5; /** Session is purged. No more tasks can be submitted and executed. Results data will be deleted. */
SESSION_STATUS_DELETED = 6; /** Session is deleted. No more tasks can be submitted and executed. Sessions, tasks and results metadata associated to the session will be deleted. */
SESSION_STATUS_PURGED = 4; /** Session is purged. No more tasks can be submitted and executed. Results data will be deleted. */
SESSION_STATUS_DELETED = 5; /** Session is deleted. No more tasks can be submitted and executed. Sessions, tasks and results metadata associated to the session will be deleted. */
}
52 changes: 11 additions & 41 deletions Protos/V1/sessions_common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import "session_status.proto";
import "sessions_fields.proto";
import "sessions_filters.proto";
import "sort_direction.proto";
import "submission_status.proto";

option csharp_namespace = "ArmoniK.Api.gRPC.V1.Sessions";

Expand All @@ -22,15 +21,16 @@ option csharp_namespace = "ArmoniK.Api.gRPC.V1.Sessions";
message SessionRaw {
string session_id = 1; /** The session ID. */
session_status.SessionStatus status = 2; /** The session status. */
submission_status.SubmissionStatus submission_status = 8; /** The submission status. */
bool client_submission = 8; /** Whether clients can submit tasks in the session. */
bool worker_submission = 9; /** Whether workers can submit tasks in the session. */
repeated string partition_ids = 3; /** The partition IDs. */
TaskOptions options = 4; /** The task options. In fact, these are used as default value in child tasks. */

google.protobuf.Timestamp created_at = 5; /** The creation date. */
google.protobuf.Timestamp cancelled_at = 6; /** The cancellation date. Only set when status is 'cancelled'. */
google.protobuf.Timestamp closed_at = 9; /** The closing date. Only set when status is 'closed'. */
google.protobuf.Timestamp purged_at = 10; /** The purge date. Only set when status is 'purged'. */
google.protobuf.Timestamp deleted_at = 11; /** The deletion date. Only set when status is 'deleted'. */
google.protobuf.Timestamp closed_at = 10; /** The closing date. Only set when status is 'closed'. */
google.protobuf.Timestamp purged_at = 11; /** The purge date. Only set when status is 'purged'. */
google.protobuf.Timestamp deleted_at = 12; /** The deletion date. Only set when status is 'deleted'. */
google.protobuf.Duration duration = 7; /** The duration. Only set when status is 'cancelled' and 'closed'. */
}

Expand Down Expand Up @@ -160,22 +160,6 @@ message ResumeSessionResponse {
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 purging a single session.
*/
Expand Down Expand Up @@ -209,33 +193,19 @@ message DeleteSessionResponse {
}

/**
* Request for stopping new tasks submissions from clients in the given session.
*/
message StopClientSubmissionRequest {
string session_id = 1; /** The session ID. */
}

/**
* Response for stopping new tasks submissions from clients in the given session.
*
* Return a raw session.
*/
message StopClientSubmissionResponse {
SessionRaw session = 1; /** The session. */
}

/**
* Request for stopping new tasks submissions from workers in the given session.
* Request for stopping new tasks submissions from clients or workers in the given session.
*/
message StopWorkerSubmissionRequest {
message StopSubmissionRequest {
string session_id = 1; /** The session ID. */
bool client = 2; /** Whether to stop client submission. */
bool worker = 3; /** Whether to stop worker submission. */
}

/**
* Response for stopping new tasks submissions from workers in the given session.
* Response for stopping new tasks submissions from clients or workers in the given session.
*
* Return a raw session.
*/
message StopWorkerSubmissionResponse {
message StopSubmissionResponse {
SessionRaw session = 1; /** The session. */
}
14 changes: 2 additions & 12 deletions Protos/V1/sessions_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ service Sessions {
*/
rpc ResumeSession(ResumeSessionRequest) returns (ResumeSessionResponse);

/**
* Close a session by its id. Also close submission in the session.
*/
rpc CloseSession(CloseSessionRequest) returns (CloseSessionResponse);

/**
* Purge a session by its id. Removes Results data.
*/
Expand All @@ -59,12 +54,7 @@ service Sessions {
rpc DeleteSession(DeleteSessionRequest) returns (DeleteSessionResponse);

/**
* Stops clients from submitting new tasks in the given session.
*/
rpc StopClientSubmission(StopClientSubmissionRequest) returns (StopClientSubmissionResponse);

/**
* Stops workers from submitting new tasks in the given session.
* Stops clients and/or workers from submitting new tasks in the given session.
*/
rpc StopWorkerSubmission(StopWorkerSubmissionRequest) returns (StopWorkerSubmissionResponse);
rpc StopSubmission(StopSubmissionRequest) returns (StopSubmissionResponse);
}
19 changes: 0 additions & 19 deletions Protos/V1/submission_status.proto

This file was deleted.

0 comments on commit e38b6ae

Please sign in to comment.