Skip to content

Commit

Permalink
feat: session submission management
Browse files Browse the repository at this point in the history
  • Loading branch information
aneojgurhem committed Jan 11, 2024
1 parent 0cb3902 commit 028404b
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Protos/V1/session_status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ 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. 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_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. */
}
55 changes: 54 additions & 1 deletion Protos/V1/sessions_common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ 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 @@ -21,12 +22,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. */
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.Duration duration = 7; /** The duration. 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.Duration duration = 7; /** The duration. Only set when status is 'cancelled' and 'closed'. */
}

/**
Expand Down Expand Up @@ -171,6 +176,22 @@ message CloseSessionResponse {
SessionRaw session = 1; /** The session. */
}

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

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

/**
* Request for deleting a single session.
*/
Expand All @@ -186,3 +207,35 @@ message DeleteSessionRequest {
message DeleteSessionResponse {
SessionRaw session = 1; /** The session. */
}

/**
* 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.
*/
message StopWorkerSubmissionRequest {
string session_id = 1; /** The session ID. */
}

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

/**
* Close a session by its id. Removes Results data.
* 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.
*/
rpc PurgeSession(PurgeSessionRequest) returns (PurgeSessionResponse);

/**
* Delete a session by its id. Removes metadata from Results, Sessions and Tasks associated to the session.
*/
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.
*/
rpc StopWorkerSubmission(StopWorkerSubmissionRequest) returns (StopWorkerSubmissionResponse);
}
19 changes: 19 additions & 0 deletions Protos/V1/submission_status.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Submission capabiltiy status.
*/
syntax = "proto3";

package armonik.api.grpc.v1.submission_status;

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

/**
* Submission status.
*/
enum SubmissionStatus {
SUBMISSION_STATUS_UNSPECIFIED = 0; /** Submission is in an unknown state. */
SUBMISSION_STATUS_ALL = 1; /** Workers and clients can submit new tasks. */
SUBMISSION_STATUS_CLIENT_ONLY = 2; /** Only clients can submit tasks. */
SUBMISSION_STATUS_WORKER_ONLY = 3; /** Only workers can submit tasks. */
SUBMISSION_STATUS_CLOSED = 4; /** Tasks cannot be submitted anymore. */
}

0 comments on commit 028404b

Please sign in to comment.