Skip to content

Commit d4826db

Browse files
authored
Add Deployment Pre-Release APIs (#479)
* Add Deployment APIs * Move UpdateDeploymentMemo to deployment dir * Address feedback & rename deployment_name * Addressed comments * Addressed feedback * improve VersioningOverride comments
1 parent 3956d6d commit d4826db

File tree

10 files changed

+1727
-236
lines changed

10 files changed

+1727
-236
lines changed

openapi/openapiv2.json

Lines changed: 759 additions & 134 deletions
Large diffs are not rendered by default.

openapi/openapiv3.yaml

Lines changed: 651 additions & 57 deletions
Large diffs are not rendered by default.

temporal/api/common/v1/message.proto

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import "google/protobuf/empty.proto";
3737
import "temporal/api/enums/v1/common.proto";
3838
import "temporal/api/enums/v1/event_type.proto";
3939
import "temporal/api/enums/v1/reset.proto";
40-
import "temporal/api/enums/v1/workflow.proto";
4140

4241
message DataBlob {
4342
temporal.api.enums.v1.EncodingType encoding_type = 1;
@@ -134,8 +133,8 @@ message WorkerVersionStamp {
134133
// marker for workflow reset points and the BuildIDs search attribute.
135134
bool use_versioning = 3;
136135

137-
// Must be sent if user has set a deployment name (versioning-3).
138-
string deployment_name = 4;
136+
// Must be sent if user has set a deployment series name (versioning-3).
137+
string deployment_series_name = 4;
139138

140139
// Later, may include bundle id that could be used for WASM and/or JS dynamically loadable bundles.
141140
}
@@ -151,32 +150,12 @@ message WorkerVersionCapabilities {
151150
// tasks.
152151
bool use_versioning = 2;
153152

154-
// Must be sent if user has set a deployment name (versioning-3).
155-
string deployment_name = 3;
153+
// Must be sent if user has set a deployment series name (versioning-3).
154+
string deployment_series_name = 4;
156155

157156
// Later, may include info like "I can process WASM and/or JS bundles"
158157
}
159158

160-
// Used in both UpdateWorkflowExecutionOptions and StartWorkflowExecution to override
161-
// the versioning behavior of a specific workflow execution. If set, takes precedence
162-
// over the sdk-sent Versioning Behavior for the specific Workflow Execution it is set on.
163-
// To remove the override, call UpdateWorkflowExecutionOptions with a null VersioningBehaviorOverride,
164-
// and use the FieldMask to indicate that it should be mutated.
165-
message VersioningBehaviorOverride {
166-
// Required.
167-
temporal.api.enums.v1.VersioningBehavior behavior = 1;
168-
169-
// Required if behavior is `PINNED`. Must be null if behavior is `AUTO_UPGRADE`.
170-
// Identifies the Build ID and Deployment Name to pin the workflow to.
171-
WorkerDeployment worker_deployment = 2;
172-
}
173-
174-
// Identifies a versioned worker deployment.
175-
message WorkerDeployment {
176-
string deployment_name = 1;
177-
string build_id = 2;
178-
}
179-
180159
// Describes where and how to reset a workflow, used for batch reset currently
181160
// and may be used for single-workflow reset later.
182161
message ResetOptions {
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// The MIT License
2+
//
3+
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
23+
syntax = "proto3";
24+
25+
package temporal.api.deployment.v1;
26+
27+
option go_package = "go.temporal.io/api/deployment/v1;deployment";
28+
option java_package = "io.temporal.api.deployment.v1";
29+
option java_multiple_files = true;
30+
option java_outer_classname = "MessageProto";
31+
option ruby_package = "Temporalio::Api::Deployment::V1";
32+
option csharp_namespace = "Temporalio.Api.Deployment.V1";
33+
34+
import "google/protobuf/timestamp.proto";
35+
36+
import "temporal/api/enums/v1/task_queue.proto";
37+
import "temporal/api/common/v1/message.proto";
38+
39+
// `Deployment` identifies a deployment of Temporal workers. The combination of deployment series
40+
// name + build ID serves as the identifier. User can use `WorkerDeploymentOptions` in their worker
41+
// programs to specify these values.
42+
message Deployment {
43+
// Different versions of the same worker service/application are related together by having a
44+
// shared series name.
45+
// Out of all deployments of a series, one can be designated as the current deployment, which
46+
// receives new workflow executions and new tasks of workflows with
47+
// `VERSIONING_BEHAVIOR_AUTO_UPGRADE` versioning behavior.
48+
string series_name = 1;
49+
// Build ID changes with each version of the worker when the worker program code and/or config
50+
// changes.
51+
string build_id = 2;
52+
}
53+
54+
// `DeploymentInfo` holds information about a deployment. Deployment information is tracked
55+
// automatically by server as soon as the first poll from that deployment reaches the server. There
56+
// can be multiple task queue workers in a single deployment which are listed in this message.
57+
message DeploymentInfo {
58+
Deployment deployment = 1;
59+
google.protobuf.Timestamp create_time = 2;
60+
repeated TaskQueueInfo task_queue_infos = 3;
61+
// A user-defined set of key-values. Can be updated as part of write operations to the
62+
// deployment, such as `SetCurrentDeployment`.
63+
map<string, temporal.api.common.v1.Payload> metadata = 4;
64+
// If this deployment is the current deployment of its deployment series.
65+
bool is_current = 5;
66+
67+
message TaskQueueInfo {
68+
string name = 1;
69+
temporal.api.enums.v1.TaskQueueType type = 2;
70+
// When server saw the first poller for this task queue in this deployment.
71+
google.protobuf.Timestamp first_poller_time = 3;
72+
}
73+
}
74+
75+
// Used as part of Deployment write APIs to update metadata attached to a deployment.
76+
message UpdateDeploymentMetadata {
77+
map<string, temporal.api.common.v1.Payload> upsert_entries = 1;
78+
// List of keys to remove from the metadata.
79+
repeated string remove_entries = 2;
80+
}
81+
82+
// DeploymentListInfo is an abbreviates set of fields from DeploymentInfo that's returned in
83+
// ListDeployments.
84+
message DeploymentListInfo {
85+
deployment.v1.Deployment deployment = 1;
86+
google.protobuf.Timestamp create_time = 2;
87+
// If this deployment is the current deployment of its deployment series.
88+
bool is_current = 3;
89+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// The MIT License
2+
//
3+
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
23+
syntax = "proto3";
24+
25+
package temporal.api.enums.v1;
26+
27+
option go_package = "go.temporal.io/api/enums/v1;enums";
28+
option java_package = "io.temporal.api.enums.v1";
29+
option java_multiple_files = true;
30+
option java_outer_classname = "DeploymentProto";
31+
option ruby_package = "Temporalio::Api::Enums::V1";
32+
option csharp_namespace = "Temporalio.Api.Enums.V1";
33+
34+
// Specify the reachability level for a deployment so users can decide if it is time to
35+
// decommission the deployment.
36+
enum DeploymentReachability {
37+
// Reachability level is not specified.
38+
DEPLOYMENT_REACHABILITY_UNSPECIFIED = 0;
39+
// The deployment is reachable by new and/or open workflows. The deployment cannot be
40+
// decommissioned safely.
41+
DEPLOYMENT_REACHABILITY_REACHABLE = 1;
42+
// The deployment is not reachable by new or open workflows, but might be still needed by
43+
// Queries sent to closed workflows. The deployment can be decommissioned safely if user does
44+
// not query closed workflows.
45+
DEPLOYMENT_REACHABILITY_CLOSED_WORKFLOWS_ONLY = 2;
46+
// The deployment is not reachable by any workflow because all the workflows who needed this
47+
// deployment went out of retention period. The deployment can be decommissioned safely.
48+
DEPLOYMENT_REACHABILITY_UNREACHABLE = 3;
49+
}

temporal/api/enums/v1/workflow.proto

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,23 @@ enum TimeoutType {
140140
}
141141

142142
enum VersioningBehavior {
143+
// Workflow is unversioned. This is the legacy behavior. An unversioned workflow's task may go
144+
// to any worker who is polling for the task queue.
143145
VERSIONING_BEHAVIOR_UNSPECIFIED = 0;
144-
// Workflow should be pinned to the current build ID until manually moved.
146+
// Workflow should be pinned to the current deployment until completion. Can still be moved
147+
// explicitly via `UpdateWorkflowExecutionOptions` API.
148+
// Activities of `PINNED` workflows are sent to the same deployment. Exception to this would be
149+
// when the activity task queue workers are not present in the workflows deployment, in which
150+
// case, the activity will be sent to the current deployment of its own task queue.
145151
VERSIONING_BEHAVIOR_PINNED = 1;
146-
// Workflow automatically moves to the latest version (default build ID of the task queue) when the next
147-
// task is dispatched.
152+
// Workflow automatically moves to the current deployment of its task queue when the next
153+
// workflow task is dispatched.
154+
// Activities of `AUTO_UPGRADE` workflows are sent to the current deployment of the workflow
155+
// execution based on the last completed workflow task. Exception to this would be when the
156+
// activity task queue workers are not present in the workflows deployment, in which case, the
157+
// activity will be sent to the current deployment of its own task queue.
158+
// Workflows stuck on a backlogged activity will still auto-upgrade if the default deployment
159+
// of their task queue changes, without having to wait for the backlogged activity to complete
160+
// on the old deployment.
148161
VERSIONING_BEHAVIOR_AUTO_UPGRADE = 2;
149162
}

temporal/api/history/v1/message.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import "temporal/api/enums/v1/failed_cause.proto";
4040
import "temporal/api/enums/v1/update.proto";
4141
import "temporal/api/enums/v1/workflow.proto";
4242
import "temporal/api/common/v1/message.proto";
43+
import "temporal/api/deployment/v1/message.proto";
4344
import "temporal/api/failure/v1/message.proto";
4445
import "temporal/api/taskqueue/v1/message.proto";
4546
import "temporal/api/update/v1/message.proto";
@@ -255,7 +256,7 @@ message WorkflowTaskCompletedEventAttributes {
255256
message CompletedDeploymentRedirectInfo {
256257
// The target deployment of the redirect. Null means a previously versioned workflow just
257258
// completed a redirect to unversioned workers.
258-
temporal.api.common.v1.WorkerDeployment deployment = 1;
259+
temporal.api.deployment.v1.Deployment deployment = 1;
259260
// Versioning behavior sent by SDK for this workflow execution on the new deployment.
260261
// Must be present if and only if `deployment` is set.
261262
temporal.api.enums.v1.VersioningBehavior versioning_behavior = 2;
@@ -268,7 +269,7 @@ message CompletedDeploymentRedirectInfo {
268269
message FailedDeploymentRedirectInfo {
269270
// The target deployment of the failed redirect attempt. Null means a versioned workflow
270271
// tried to redirect to unversioned workers.
271-
temporal.api.common.v1.WorkerDeployment deployment = 1;
272+
temporal.api.deployment.v1.Deployment deployment = 1;
272273
}
273274

274275
message WorkflowTaskTimedOutEventAttributes {

temporal/api/workflow/v1/message.proto

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import "google/protobuf/timestamp.proto";
3838
import "temporal/api/enums/v1/common.proto";
3939
import "temporal/api/enums/v1/workflow.proto";
4040
import "temporal/api/common/v1/message.proto";
41+
import "temporal/api/deployment/v1/message.proto";
4142
import "temporal/api/failure/v1/message.proto";
4243
import "temporal/api/taskqueue/v1/message.proto";
4344
import "temporal/api/sdk/v1/user_metadata.proto";
@@ -107,29 +108,27 @@ message WorkflowExecutionInfo {
107108

108109
message VersioningInfo {
109110
// Determines how server should treat this execution when workers are upgraded.
110-
// When present it means that this workflow is versioned. This is not set until an execution
111+
// When present it means that this workflow is versioned. This is set after an execution
111112
// completes its first workflow task on a versioned worker.
112113
temporal.api.enums.v1.VersioningBehavior behavior = 1;
113114
// The worker deployment to which this workflow is assigned currently.
114115
// Must be present if and only if `behavior` is set.
115-
temporal.api.common.v1.WorkerDeployment deployment = 2;
116-
// Manual override for execution's versioning behavior. Takes precedence over `behavior`.
117-
temporal.api.enums.v1.VersioningBehavior behavior_override = 3;
118-
// Used to manually pin the execution to a deployment. Must be set when if and only if
119-
// `behavior_override` is PINNED. Takes precedence over `deployment`.
120-
temporal.api.common.v1.WorkerDeployment deployment_override = 4;
116+
temporal.api.deployment.v1.Deployment deployment = 2;
117+
// Present if user has set an execution-specific versioning override. This override takes
118+
// precedence over SDK-sent `behavior` and `deployment`.
119+
VersioningOverride versioning_override = 3;
121120
// When present, indicates the workflow is being redirected to a different deployment.
122-
// A deployment redirect can only exist during the life time of a pending workflow task.
121+
// A redirect can only exist during the lifetime of a pending workflow task.
123122
// If the pending workflow task completes (at the next WorkflowTaskCompleted event), the
124123
// redirect is considered complete and the workflow's deployment is updated. If the pending
125124
// workflow task fails or times out, then the redirect is canceled and workflow remains on
126125
// the previous deployment.
127-
RedirectInfo redirect_info = 5;
126+
RedirectInfo redirect_info = 4;
128127

129128
message RedirectInfo {
130129
// The target deployment of the redirect. Null means a so-far-versioned workflow is
131130
// being redirected to unversioned workers.
132-
temporal.api.common.v1.WorkerDeployment deployment = 1;
131+
temporal.api.deployment.v1.Deployment deployment = 1;
133132
// If present, it means the redirect is initiated by a (safe) manual versioning
134133
// override. Such override is only applied to the workflow when and if the redirect
135134
// successfully completes.
@@ -192,7 +191,7 @@ message PendingActivityInfo {
192191

193192
// The deployment this activity was dispatched to most recently. Present only if the activity
194193
// was dispatched to a versioned worker.
195-
temporal.api.common.v1.WorkerDeployment last_started_deployment = 19;
194+
temporal.api.deployment.v1.Deployment last_started_deployment = 19;
196195
}
197196

198197
message PendingChildExecutionInfo {
@@ -363,6 +362,20 @@ message NexusOperationCancellationInfo {
363362
}
364363

365364
message WorkflowExecutionOptions {
366-
// If set, takes precedence over the sdk-sent Versioning Behavior for the specific Workflow Execution it is set on.
367-
temporal.api.common.v1.VersioningBehaviorOverride versioning_behavior_override = 1;
368-
}
365+
// If set, takes precedence over the sdk-sent Versioning Behavior for the specific Workflow
366+
// Execution it is set on.
367+
VersioningOverride versioning_override = 1;
368+
}
369+
370+
// Used to override the versioning behavior and deployment of a specific workflow execution. If set,
371+
// takes precedence over the worker-sent values. See `WorkflowExecutionInfo.VersioningInfo` for more
372+
// information. To remove the override, call `UpdateWorkflowExecutionOptions` with a null
373+
// `VersioningOverride`, and use the `update_mask` to indicate that it should be mutated.
374+
message VersioningOverride {
375+
// Required.
376+
temporal.api.enums.v1.VersioningBehavior behavior = 1;
377+
378+
// Required if behavior is `PINNED`. Must be null if behavior is `AUTO_UPGRADE`.
379+
// Identifies the worker deployment to pin the workflow to.
380+
temporal.api.deployment.v1.Deployment deployment = 2;
381+
}

0 commit comments

Comments
 (0)