Skip to content

Commit e11b55a

Browse files
authored
VersionStatus for WorkerDeploymentVersions (#595)
_**READ BEFORE MERGING:** All PRs require approval by both Server AND SDK teams before merging! This is why the number of required approvals is "2" and not "1"--two reviewers from the same team is NOT sufficient. If your PR is not approved by someone in BOTH teams, it may be summarily reverted._ <!-- Describe what has changed in this PR --> **What changed?** - add VersionStatus inside `WorkerDeploymentVersionInfo` + `WorkerDeploymentVersionSummary` <!-- Tell your future self why have you made these changes --> **Why?** - right now, the UI code deduces the status of a version by checking `CurrentSince`, `RampingSince` and other attributes. This can just be simplified by adding this enum and the server doing the heavy lifting instead. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** - None <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR** - [741011](temporalio/temporal#7804)
1 parent 53fbd4f commit e11b55a

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed

openapi/openapiv2.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7107,6 +7107,10 @@
71077107
"type": "string",
71087108
"description": "Deprecated. Use `deployment_version`."
71097109
},
7110+
"status": {
7111+
"$ref": "#/definitions/v1WorkerDeploymentVersionStatus",
7112+
"description": "The status of the Worker Deployment Version."
7113+
},
71107114
"deploymentVersion": {
71117115
"$ref": "#/definitions/v1WorkerDeploymentVersion",
71127116
"description": "Required."
@@ -14957,6 +14961,10 @@
1495714961
"type": "string",
1495814962
"description": "Deprecated. Use `deployment_version`."
1495914963
},
14964+
"status": {
14965+
"$ref": "#/definitions/v1WorkerDeploymentVersionStatus",
14966+
"description": "The status of the Worker Deployment Version."
14967+
},
1496014968
"deploymentVersion": {
1496114969
"$ref": "#/definitions/v1WorkerDeploymentVersion",
1496214970
"description": "Required."
@@ -15017,6 +15025,19 @@
1501715025
},
1501815026
"description": "A Worker Deployment Version (Version, for short) represents all workers of the same \ncode and config within a Deployment. Workers of the same Version are expected to \nbehave exactly the same so when executions move between them there are no \nnon-determinism issues.\nWorker Deployment Versions are created in Temporal server automatically when \ntheir first poller arrives to the server.\nExperimental. Worker Deployments are experimental and might significantly change in the future."
1501915027
},
15028+
"v1WorkerDeploymentVersionStatus": {
15029+
"type": "string",
15030+
"enum": [
15031+
"WORKER_DEPLOYMENT_VERSION_STATUS_UNSPECIFIED",
15032+
"WORKER_DEPLOYMENT_VERSION_STATUS_INACTIVE",
15033+
"WORKER_DEPLOYMENT_VERSION_STATUS_CURRENT",
15034+
"WORKER_DEPLOYMENT_VERSION_STATUS_RAMPING",
15035+
"WORKER_DEPLOYMENT_VERSION_STATUS_DRAINING",
15036+
"WORKER_DEPLOYMENT_VERSION_STATUS_DRAINED"
15037+
],
15038+
"default": "WORKER_DEPLOYMENT_VERSION_STATUS_UNSPECIFIED",
15039+
"description": "Specify the status of a Worker Deployment Version.\nExperimental. Worker Deployments are experimental and might significantly change in the future.\n\n - WORKER_DEPLOYMENT_VERSION_STATUS_INACTIVE: The Worker Deployment Version has been created inside the Worker Deployment but is not used by any\nworkflow executions. These Versions can still have workflows if they have an explicit Versioning Override targeting\nthis Version. Such Versioning Override could be set at workflow start time, or at a later time via `UpdateWorkflowExecutionOptions`.\n - WORKER_DEPLOYMENT_VERSION_STATUS_CURRENT: The Worker Deployment Version is the current version of the Worker Deployment. All new workflow executions \nand tasks of existing unversioned or AutoUpgrade workflows are routed to this version.\n - WORKER_DEPLOYMENT_VERSION_STATUS_RAMPING: The Worker Deployment Version is the ramping version of the Worker Deployment. A subset of new Pinned workflow executions are \nrouted to this version. Moreover, a portion of existing unversioned or AutoUpgrade workflow executions are also routed to this version.\n - WORKER_DEPLOYMENT_VERSION_STATUS_DRAINING: The Worker Deployment Version is not used by new workflows but is still used by\nopen pinned workflows. The version cannot be decommissioned safely.\n - WORKER_DEPLOYMENT_VERSION_STATUS_DRAINED: The Worker Deployment Version is not used by new or open workflows, but might be still needed by\nQueries sent to closed workflows. The version can be decommissioned safely if user does\nnot query closed workflows. If the user does query closed workflows for some time x after\nworkflows are closed, they should decommission the version after it has been drained for that duration."
15040+
},
1502015041
"v1WorkerVersionCapabilities": {
1502115042
"type": "object",
1502215043
"properties": {

openapi/openapiv3.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12223,6 +12223,17 @@ components:
1222312223
version:
1222412224
type: string
1222512225
description: Deprecated. Use `deployment_version`.
12226+
status:
12227+
enum:
12228+
- WORKER_DEPLOYMENT_VERSION_STATUS_UNSPECIFIED
12229+
- WORKER_DEPLOYMENT_VERSION_STATUS_INACTIVE
12230+
- WORKER_DEPLOYMENT_VERSION_STATUS_CURRENT
12231+
- WORKER_DEPLOYMENT_VERSION_STATUS_RAMPING
12232+
- WORKER_DEPLOYMENT_VERSION_STATUS_DRAINING
12233+
- WORKER_DEPLOYMENT_VERSION_STATUS_DRAINED
12234+
type: string
12235+
description: The status of the Worker Deployment Version.
12236+
format: enum
1222612237
deploymentVersion:
1222712238
allOf:
1222812239
- $ref: '#/components/schemas/WorkerDeploymentVersion'
@@ -12320,6 +12331,17 @@ components:
1232012331
version:
1232112332
type: string
1232212333
description: Deprecated. Use `deployment_version`.
12334+
status:
12335+
enum:
12336+
- WORKER_DEPLOYMENT_VERSION_STATUS_UNSPECIFIED
12337+
- WORKER_DEPLOYMENT_VERSION_STATUS_INACTIVE
12338+
- WORKER_DEPLOYMENT_VERSION_STATUS_CURRENT
12339+
- WORKER_DEPLOYMENT_VERSION_STATUS_RAMPING
12340+
- WORKER_DEPLOYMENT_VERSION_STATUS_DRAINING
12341+
- WORKER_DEPLOYMENT_VERSION_STATUS_DRAINED
12342+
type: string
12343+
description: The status of the Worker Deployment Version.
12344+
format: enum
1232312345
deploymentVersion:
1232412346
allOf:
1232512347
- $ref: '#/components/schemas/WorkerDeploymentVersion'

temporal/api/deployment/v1/message.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ message WorkerDeploymentVersionInfo {
9797
// Deprecated. Use `deployment_version`.
9898
string version = 1 [deprecated = true];
9999

100+
// The status of the Worker Deployment Version.
101+
temporal.api.enums.v1.WorkerDeploymentVersionStatus status = 14;
102+
100103
// Required.
101104
WorkerDeploymentVersion deployment_version = 11;
102105
string deployment_name = 2;
@@ -195,6 +198,9 @@ message WorkerDeploymentInfo {
195198
// Deprecated. Use `deployment_version`.
196199
string version = 1 [deprecated = true];
197200

201+
// The status of the Worker Deployment Version.
202+
temporal.api.enums.v1.WorkerDeploymentVersionStatus status = 11;
203+
198204
// Required.
199205
WorkerDeploymentVersion deployment_version = 4;
200206
google.protobuf.Timestamp create_time = 2;

temporal/api/enums/v1/deployment.proto

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,29 @@ enum WorkerVersioningMode {
7272
// VersioningBehavior enum.)
7373
WORKER_VERSIONING_MODE_VERSIONED = 2;
7474
}
75+
76+
// (-- api-linter: core::0216::synonyms=disabled
77+
// aip.dev/not-precedent: Call this status because it is . --)
78+
// Specify the status of a Worker Deployment Version.
79+
// Experimental. Worker Deployments are experimental and might significantly change in the future.
80+
enum WorkerDeploymentVersionStatus {
81+
WORKER_DEPLOYMENT_VERSION_STATUS_UNSPECIFIED = 0;
82+
// The Worker Deployment Version has been created inside the Worker Deployment but is not used by any
83+
// workflow executions. These Versions can still have workflows if they have an explicit Versioning Override targeting
84+
// this Version. Such Versioning Override could be set at workflow start time, or at a later time via `UpdateWorkflowExecutionOptions`.
85+
WORKER_DEPLOYMENT_VERSION_STATUS_INACTIVE = 1;
86+
// The Worker Deployment Version is the current version of the Worker Deployment. All new workflow executions
87+
// and tasks of existing unversioned or AutoUpgrade workflows are routed to this version.
88+
WORKER_DEPLOYMENT_VERSION_STATUS_CURRENT = 2;
89+
// The Worker Deployment Version is the ramping version of the Worker Deployment. A subset of new Pinned workflow executions are
90+
// routed to this version. Moreover, a portion of existing unversioned or AutoUpgrade workflow executions are also routed to this version.
91+
WORKER_DEPLOYMENT_VERSION_STATUS_RAMPING = 3;
92+
// The Worker Deployment Version is not used by new workflows but is still used by
93+
// open pinned workflows. The version cannot be decommissioned safely.
94+
WORKER_DEPLOYMENT_VERSION_STATUS_DRAINING = 4;
95+
// The Worker Deployment Version is not used by new or open workflows, but might be still needed by
96+
// Queries sent to closed workflows. The version can be decommissioned safely if user does
97+
// not query closed workflows. If the user does query closed workflows for some time x after
98+
// workflows are closed, they should decommission the version after it has been drained for that duration.
99+
WORKER_DEPLOYMENT_VERSION_STATUS_DRAINED = 5;
100+
}

0 commit comments

Comments
 (0)