Skip to content

Commit 7aa4ab6

Browse files
Rework workflow release content description (#49)
1 parent 5712823 commit 7aa4ab6

3 files changed

Lines changed: 67 additions & 120 deletions

File tree

‎apis/workflows/v1/task_release.proto‎

Lines changed: 0 additions & 117 deletions
This file was deleted.

‎apis/workflows/v1/worker.proto‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
edition = "2023";
2+
3+
package workflows.v1;
4+
5+
import "buf/validate/validate.proto";
6+
import "google/protobuf/empty.proto";
7+
import "workflows/v1/core.proto";
8+
import "workflows/v1/task.proto";
9+
10+
// HandshakeRequest is sent by the runner to a worker runtime to discover its capabilities.
11+
message HandshakeRequest {}
12+
13+
// HandshakeResponse is the response to a handshake request, containing the task identifiers that the worker can execute.
14+
message HandshakeResponse {
15+
workflows.v1.TaskIdentifiers task_identifiers = 1;
16+
}
17+
18+
// ExecuteTaskResponse is the response of a worker runtime to a request to execute a task, after the task has
19+
// been executed.
20+
message ExecuteTaskResponse {
21+
option (buf.validate.message).oneof = {
22+
fields: [
23+
"computed_task",
24+
"failed_task"
25+
]
26+
};
27+
28+
// If the task execution succeeded, this field will be set with the computed task result.
29+
workflows.v1.ComputedTask computed_task = 1;
30+
31+
// If the task execution failed, this field will be set with details about the failure.
32+
workflows.v1.TaskFailedRequest failed_task = 2;
33+
}
34+
35+
// WorkerService defines the RPC interface between a runner and a a worker runtime that can execute workflow tasks.
36+
service WorkerService {
37+
rpc Handshake(HandshakeRequest) returns (HandshakeResponse) {}
38+
rpc ExecuteTask(workflows.v1.Task) returns (workflows.v1.ComputedTask) {}
39+
rpc Shutdown(google.protobuf.Empty) returns (google.protobuf.Empty) {}
40+
}

‎apis/workflows/v1/workflows.proto‎

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ message GetWorkflowRequest {
6767
message PublishWorkflowReleaseRequest {
6868
string workflow_slug = 1 [(buf.validate.field).string.min_len = 1];
6969
tilebox.v1.ID artifact_id = 2 [(buf.validate.field).required = true];
70-
repeated TaskIdentifier tasks = 3 [(buf.validate.field).repeated.min_items = 1];
70+
ReleaseContent content = 3 [(buf.validate.field).required = true];
7171
}
7272

7373
// ListWorkflowsRequest lists all workflows.
@@ -98,11 +98,35 @@ message Workflow {
9898
// WorkflowRelease represents an immutable release of a workflow, which includes a set of tasks and an artifact.
9999
message WorkflowRelease {
100100
tilebox.v1.ID id = 1;
101-
tilebox.v1.ID artifact_id = 2;
102-
repeated TaskIdentifier tasks = 3;
101+
Artifact artifact = 2;
102+
ReleaseContent content = 3;
103103
google.protobuf.Timestamp created_at = 4;
104104
}
105105

106+
// Artifact represents the artifact associated with a workflow release,
107+
// which is the file that contains the code and dependencies needed to execute the tasks in the release.
108+
message Artifact {
109+
tilebox.v1.ID id = 1;
110+
string digest = 2 [(buf.validate.field).string.pattern = "^[a-f0-9]{64}$"];
111+
}
112+
113+
// ReleaseContent represents the content of a workflow release, which is the set of files that are included,
114+
// the list of task identifiers, and the command to start a worker runtime for executing the tasks in the release.
115+
// The fingerprint is a hash of the release content.
116+
message ReleaseContent {
117+
string fingerprint = 1 [(buf.validate.field).string.pattern = "^[a-f0-9]{64}$"];
118+
repeated TaskIdentifier tasks = 2 [(buf.validate.field).repeated.min_items = 1];
119+
Path root = 3;
120+
repeated string command = 4;
121+
}
122+
123+
// Path represents a file or directory path in the release content. If it is a directory, it can have child paths.
124+
message Path {
125+
string path = 1;
126+
bool directory = 2;
127+
repeated Path children = 3;
128+
}
129+
106130
// DeployWorkflowReleaseRequest deploys a workflow release to a set of clusters, making the tasks available for
107131
// execution on those clusters.
108132
message DeployWorkflowReleaseRequest {

0 commit comments

Comments
 (0)