diff --git a/apis/workflows/v1/core.proto b/apis/workflows/v1/core.proto index 889fc2e..7413d87 100644 --- a/apis/workflows/v1/core.proto +++ b/apis/workflows/v1/core.proto @@ -41,6 +41,8 @@ message Job { repeated TaskSummary task_summaries = 9; // The automation that submitted the job. tilebox.v1.ID automation_id = 10; + // A list of progress bars for the job. + repeated ProgressBar progress_bars = 11; } // The state of a job. @@ -65,6 +67,16 @@ message TaskSummary { google.protobuf.Timestamp stopped_at = 7; } +// ProgressBar is an indication of progress for a workflow. +message ProgressBar { + // A human-readable label displayed next to the progress bar. Can also be empty. + string label = 1 [(buf.validate.field).string.max_len = 100]; + // The total number of work units to be processed. + uint64 total = 2; + // The number of work units that have already been processed. + uint64 done = 3; +} + // A task is a single unit of work. message Task { // The id of the task instance. Contains the submission timestamp as the time part of the ULID. diff --git a/apis/workflows/v1/task.proto b/apis/workflows/v1/task.proto index a8be6b6..466a3cb 100644 --- a/apis/workflows/v1/task.proto +++ b/apis/workflows/v1/task.proto @@ -37,6 +37,8 @@ message ComputedTask { string display = 2; // A list of sub-tasks that the just computed task spawned. repeated TaskSubmission sub_tasks = 3 [(buf.validate.field).repeated.max_items = 64]; + // A list of progress bar updates that the computed task wants to report. + repeated ProgressBar progress_updates = 4; } // IdlingResponse is set in the response of a NextTaskRequest if no task was returned, indicating that the requesting @@ -64,9 +66,17 @@ message NextTaskResponse { // TaskFailedRequest is the request for marking a task as failed. message TaskFailedRequest { + // The id of the task that has failed. tilebox.v1.ID task_id = 1 [(buf.validate.field).required = true]; + // A display name for the task that has failed for visualization purposes. string display = 2; + // Whether to cancel the job that the task belongs to. bool cancel_job = 3; + // A list of progress bar updates that the failed task wants to report. Even if a task fails, it could + // still have made some progress before failing, and we want to reflect that progress. + // Since progress updates are idempotent, retrying the task and getting the same progress update again + // is not an issue. + repeated ProgressBar progress_updates = 4; } // TaskStateResponse is the response to the TaskFailed request,