From 028404b8ef4425e64ec2be703b54de54ad89535d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gurhem?= Date: Thu, 11 Jan 2024 08:27:06 +0100 Subject: [PATCH] feat: session submission management --- Protos/V1/session_status.proto | 5 +-- Protos/V1/sessions_common.proto | 55 ++++++++++++++++++++++++++++++- Protos/V1/sessions_service.proto | 17 +++++++++- Protos/V1/submission_status.proto | 19 +++++++++++ 4 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 Protos/V1/submission_status.proto diff --git a/Protos/V1/session_status.proto b/Protos/V1/session_status.proto index 4f59479ca..88cfe1ca2 100644 --- a/Protos/V1/session_status.proto +++ b/Protos/V1/session_status.proto @@ -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. */ } diff --git a/Protos/V1/sessions_common.proto b/Protos/V1/sessions_common.proto index 079a48972..d4fbd0a30 100644 --- a/Protos/V1/sessions_common.proto +++ b/Protos/V1/sessions_common.proto @@ -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"; @@ -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'. */ } /** @@ -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. */ @@ -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. */ +} diff --git a/Protos/V1/sessions_service.proto b/Protos/V1/sessions_service.proto index f3ad8ed78..006ce83d3 100644 --- a/Protos/V1/sessions_service.proto +++ b/Protos/V1/sessions_service.proto @@ -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); } diff --git a/Protos/V1/submission_status.proto b/Protos/V1/submission_status.proto new file mode 100644 index 000000000..c3973533b --- /dev/null +++ b/Protos/V1/submission_status.proto @@ -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. */ +}