Skip to content

Commit a3effac

Browse files
authored
Add worker-build-id-based versioning api (#190)
Refer to temporalio/proposals#54 for original proposal
1 parent abcd7eb commit a3effac

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

Diff for: temporal/api/taskqueue/v1/message.proto

+20
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,23 @@ message StickyExecutionAttributes {
8383
// aip.dev/not-precedent: "to" is used to indicate interval. --)
8484
google.protobuf.Duration schedule_to_start_timeout = 2 [(gogoproto.stdduration) = true];
8585
}
86+
87+
// Used by the worker versioning APIs, represents a node in the version graph for a particular
88+
// task queue
89+
message VersionIdNode {
90+
VersionId version = 1;
91+
// A pointer to the previous version this version is considered to be compatible with
92+
VersionIdNode previous_compatible = 2;
93+
// A pointer to the last incompatible version (previous major version)
94+
VersionIdNode previous_incompatible = 3;
95+
}
96+
97+
// Used by the worker versioning APIs, represents a specific version of something
98+
// Currently, that's just a whole-worker id. In the future, if we support
99+
// WASM workflow bundle based versioning, for example, then the inside of this
100+
// message may become a oneof of different version types.
101+
message VersionId {
102+
// An opaque whole-worker identifier
103+
string worker_build_id = 1;
104+
}
105+

Diff for: temporal/api/workflow/v1/message.proto

+1
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,4 @@ message NewWorkflowExecutionInfo {
142142
temporal.api.common.v1.SearchAttributes search_attributes = 12;
143143
temporal.api.common.v1.Header header = 13;
144144
}
145+

Diff for: temporal/api/workflowservice/v1/request_response.proto

+45
Original file line numberDiff line numberDiff line change
@@ -950,3 +950,48 @@ message ListSchedulesResponse {
950950
repeated temporal.api.schedule.v1.ScheduleListEntry schedules = 1;
951951
bytes next_page_token = 2;
952952
}
953+
954+
// (-- api-linter: core::0134::request-mask-required=disabled
955+
// aip.dev/not-precedent: UpdateWorkerBuildIdOrderingRequest doesn't follow Google API format --)
956+
// (-- api-linter: core::0134::request-resource-required=disabled
957+
// aip.dev/not-precedent: UpdateWorkerBuildIdOrderingRequest RPC doesn't follow Google API format. --)
958+
message UpdateWorkerBuildIdOrderingRequest {
959+
string namespace = 1;
960+
// Must be set, the task queue to apply changes to. Because all workers on
961+
// a given task queue must have the same set of workflow & activity
962+
// implementations, there is no reason to specify a task queue type here.
963+
string task_queue = 2;
964+
// The version id we are targeting.
965+
temporal.api.taskqueue.v1.VersionId version_id = 3;
966+
// When set, indicates that the `version_id` in this message is compatible
967+
// with the one specified in this field. Because compatability should form
968+
// a DAG, any build id can only be the "next compatible" version for one
969+
// other ID of a certain type at a time, and any setting which would create a cycle is invalid.
970+
temporal.api.taskqueue.v1.VersionId previous_compatible = 4;
971+
// When set, establishes the specified `version_id` as the default of it's type
972+
// for the queue. Workers matching it will begin processing new workflow executions.
973+
// The existing default will be marked as a previous incompatible version
974+
// to this one, assuming it is not also in `is_compatible_with`.
975+
bool become_default = 5;
976+
}
977+
message UpdateWorkerBuildIdOrderingResponse {}
978+
979+
// (-- api-linter: core::0134::request-resource-required=disabled
980+
// aip.dev/not-precedent: GetWorkerBuildIdOrderingRequest RPC doesn't follow Google API format. --)
981+
message GetWorkerBuildIdOrderingRequest {
982+
string namespace = 1;
983+
// Must be set, the task queue to interrogate about worker id ordering
984+
string task_queue = 2;
985+
// Limits how deep the returned DAG will go. 1 will return only the
986+
// default build id. A default/0 value will return the entire graph.
987+
int32 max_depth = 3;
988+
}
989+
message GetWorkerBuildIdOrderingResponse {
990+
// The currently established default version
991+
temporal.api.taskqueue.v1.VersionIdNode current_default = 1;
992+
// Other current latest-compatible versions who are not the overall default. These are the
993+
// versions that will be used when generating new tasks by following the graph from the
994+
// version of the last task out to a leaf.
995+
repeated temporal.api.taskqueue.v1.VersionIdNode compatible_leaves = 2;
996+
}
997+

Diff for: temporal/api/workflowservice/v1/service.proto

+8
Original file line numberDiff line numberDiff line change
@@ -368,4 +368,12 @@ service WorkflowService {
368368
// List all schedules in a namespace.
369369
rpc ListSchedules (ListSchedulesRequest) returns (ListSchedulesResponse) {
370370
}
371+
372+
// (-- api-linter: core::0134::response-message-name=disabled
373+
// aip.dev/not-precedent: UpdateWorkerBuildIdOrdering RPC doesn't follow Google API format. --)
374+
// (-- api-linter: core::0134::method-signature=disabled
375+
// aip.dev/not-precedent: UpdateWorkerBuildIdOrdering RPC doesn't follow Google API format. --)
376+
rpc UpdateWorkerBuildIdOrdering (UpdateWorkerBuildIdOrderingRequest) returns (UpdateWorkerBuildIdOrderingResponse) {}
377+
// This could / maybe should just be part of `DescribeTaskQueue`, but is broken out here to show easily.
378+
rpc GetWorkerBuildIdOrdering (GetWorkerBuildIdOrderingRequest) returns (GetWorkerBuildIdOrderingResponse) {}
371379
}

0 commit comments

Comments
 (0)