From 0c4eb500e47cd6f39306baf2772b8e5a339be7da Mon Sep 17 00:00:00 2001 From: Lukas Bindreiter Date: Thu, 31 Jul 2025 14:15:26 +0200 Subject: [PATCH] Add idling response to next task response --- apis/workflows/v1/task.proto | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/apis/workflows/v1/task.proto b/apis/workflows/v1/task.proto index b3a54fb..a8be6b6 100644 --- a/apis/workflows/v1/task.proto +++ b/apis/workflows/v1/task.proto @@ -39,10 +39,27 @@ message ComputedTask { repeated TaskSubmission sub_tasks = 3 [(buf.validate.field).repeated.max_items = 64]; } +// IdlingResponse is set in the response of a NextTaskRequest if no task was returned, indicating that the requesting +// task runner should idle. +message IdlingResponse { + // The suggested duration the task runner should idle for before sending another request for a task. + google.protobuf.Duration suggested_idling_duration = 1; +} + // NextTaskResponse is the response to the NextTask request. -// Right now it only contains the next task to run. Wrapped in a message to allow adding more fields later if needed. +// If the NextTask request contained a request for a task, the response will either contain a next_task, or an idling +// response, but not both. +// If the NextTask request did not contain a request for a next task (indicating the the runner is about to shut down), +// the response will be empty. message NextTaskResponse { + option (buf.validate.message).oneof = { + fields: [ + "next_task", + "idling" + ] + }; Task next_task = 1; + IdlingResponse idling = 2; } // TaskFailedRequest is the request for marking a task as failed.