Skip to content

Commit e39bdc7

Browse files
authored
Update Workflow and Activity Priority (#610)
_**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?** Added `Priority` field to the workflow and activity update API options. Batch API support is going to be added in a follow-up PR. <!-- Tell your future self why have you made these changes --> **Why?** Allow users to update priority after the workflow/activity was submitted. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** See field deprecation. <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR** TBD
1 parent edd6c6b commit e39bdc7

File tree

5 files changed

+95
-17
lines changed

5 files changed

+95
-17
lines changed

openapi/openapiv2.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9593,6 +9593,10 @@
95939593
},
95949594
"retryPolicy": {
95959595
"$ref": "#/definitions/v1RetryPolicy"
9596+
},
9597+
"priority": {
9598+
"$ref": "#/definitions/v1Priority",
9599+
"description": "Priority metadata. If this message is not present, or any fields are not\npresent, they inherit the values from the workflow."
95969600
}
95979601
}
95989602
},
@@ -13158,7 +13162,7 @@
1315813162
},
1315913163
"priority": {
1316013164
"$ref": "#/definitions/v1Priority",
13161-
"title": "Priority metadata"
13165+
"description": "Priority metadata. If this message is not present, or any fields are not\npresent, they inherit the values from the workflow."
1316213166
},
1316313167
"pauseInfo": {
1316413168
"$ref": "#/definitions/PendingActivityInfoPauseInfo"
@@ -16988,6 +16992,10 @@
1698816992
"versioningOverride": {
1698916993
"$ref": "#/definitions/v1VersioningOverride",
1699016994
"description": "If set, takes precedence over the Versioning Behavior sent by the SDK on Workflow Task completion."
16995+
},
16996+
"priority": {
16997+
"$ref": "#/definitions/v1Priority",
16998+
"description": "If set, overrides the workflow's priority sent by the SDK."
1699116999
}
1699217000
}
1699317001
},
@@ -17004,7 +17012,7 @@
1700417012
},
1700517013
"attachedRequestId": {
1700617014
"type": "string",
17007-
"description": "Request ID attachedto the running workflow execution so that subsequent requests with same\nrequest ID will be deduped."
17015+
"description": "Request ID attached to the running workflow execution so that subsequent requests with same\nrequest ID will be deduped."
1700817016
},
1700917017
"attachedCompletionCallbacks": {
1701017018
"type": "array",
@@ -17017,6 +17025,10 @@
1701717025
"identity": {
1701817026
"type": "string",
1701917027
"description": "Optional. The identity of the client who initiated the request that created this event."
17028+
},
17029+
"priority": {
17030+
"$ref": "#/definitions/v1Priority",
17031+
"description": "Priority override upserted in this event. Represents the full priority; not just partial fields.\nIgnored if nil."
1702017032
}
1702117033
}
1702217034
},
@@ -17228,11 +17240,11 @@
1722817240
},
1722917241
"inheritedPinnedVersion": {
1723017242
"$ref": "#/definitions/v1WorkerDeploymentVersion",
17231-
"description": "If present, the new workflow should start on this version with pinned base behavior.\nChild of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version.\n\nA new run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the\nnew run's Task Queue belongs to that version.\n\nA new run initiated by workflow Cron will never inherit.\n\nA new run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time\nof retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned\nparent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version).\n\nPinned override is inherited if Task Queue of new run is compatible with the override version.\nOverride is inherited separately and takes precedence over inherited base version.\n\nNote: This field is mutually exclusive with inherited_auto_upgrade_info. \nAdditionaly, versioning_override, if present, overrides this field during routing decisions."
17243+
"description": "If present, the new workflow should start on this version with pinned base behavior.\nChild of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version.\n\nA new run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the\nnew run's Task Queue belongs to that version.\n\nA new run initiated by workflow Cron will never inherit.\n\nA new run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time\nof retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned\nparent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version).\n\nPinned override is inherited if Task Queue of new run is compatible with the override version.\nOverride is inherited separately and takes precedence over inherited base version.\n\nNote: This field is mutually exclusive with inherited_auto_upgrade_info.\nAdditionaly, versioning_override, if present, overrides this field during routing decisions."
1723217244
},
1723317245
"inheritedAutoUpgradeInfo": {
1723417246
"$ref": "#/definitions/v1InheritedAutoUpgradeInfo",
17235-
"description": "If present, the new workflow begins with AutoUpgrade behavior. Before dispatching the\nfirst workflow task, this field is set to the deployment version on which the parent/\nprevious run was operating. This inheritance only happens when the task queues belong to\nthe same deployment version. The first workflow task will then be dispatched to either\nthis inherited deployment version, or the current deployment version of the task queue's\nDeployment. After the first workflow task, the effective behavior depends on worker-sent\nvalues in subsequent workflow tasks.\n\nInheritance rules:\n - ContinueAsNew and child workflows: inherit AutoUpgrade behavior and deployment version\n - Cron: never inherits\n - Retry: inherits only if the retried run is effectively AutoUpgrade at the time of\n retry, and inherited AutoUpgrade behavior when it started (i.e. it is a child of an\n AutoUpgrade parent or ContinueAsNew of an AutoUpgrade run, running on the same\n deployment as the parent/previous run)\n\nAdditional notes: \n- This field is mutually exclusive with `inherited_pinned_version`. \n- `versioning_override`, if present, overrides this field during routing decisions.\n- SDK implementations do not interact with this field and is only used internally by \n the server to ensure task routing correctness."
17247+
"description": "If present, the new workflow begins with AutoUpgrade behavior. Before dispatching the\nfirst workflow task, this field is set to the deployment version on which the parent/\nprevious run was operating. This inheritance only happens when the task queues belong to\nthe same deployment version. The first workflow task will then be dispatched to either\nthis inherited deployment version, or the current deployment version of the task queue's\nDeployment. After the first workflow task, the effective behavior depends on worker-sent\nvalues in subsequent workflow tasks.\n\nInheritance rules:\n - ContinueAsNew and child workflows: inherit AutoUpgrade behavior and deployment version\n - Cron: never inherits\n - Retry: inherits only if the retried run is effectively AutoUpgrade at the time of\n retry, and inherited AutoUpgrade behavior when it started (i.e. it is a child of an\n AutoUpgrade parent or ContinueAsNew of an AutoUpgrade run, running on the same\n deployment as the parent/previous run)\n\nAdditional notes:\n- This field is mutually exclusive with `inherited_pinned_version`.\n- `versioning_override`, if present, overrides this field during routing decisions.\n- SDK implementations do not interact with this field and is only used internally by\n the server to ensure task routing correctness."
1723617248
},
1723717249
"eagerExecutionAccepted": {
1723817250
"type": "boolean",

openapi/openapiv3.yaml

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6681,6 +6681,12 @@ components:
66816681
description: Maximum permitted time between successful worker heartbeats.
66826682
retryPolicy:
66836683
$ref: '#/components/schemas/RetryPolicy'
6684+
priority:
6685+
allOf:
6686+
- $ref: '#/components/schemas/Priority'
6687+
description: |-
6688+
Priority metadata. If this message is not present, or any fields are not
6689+
present, they inherit the values from the workflow.
66846690
ActivityPropertiesModifiedExternallyEventAttributes:
66856691
type: object
66866692
properties:
@@ -9921,7 +9927,9 @@ components:
99219927
priority:
99229928
allOf:
99239929
- $ref: '#/components/schemas/Priority'
9924-
description: Priority metadata
9930+
description: |-
9931+
Priority metadata. If this message is not present, or any fields are not
9932+
present, they inherit the values from the workflow.
99259933
pauseInfo:
99269934
$ref: '#/components/schemas/PendingActivityInfo_PauseInfo'
99279935
activityOptions:
@@ -14466,6 +14474,10 @@ components:
1446614474
allOf:
1446714475
- $ref: '#/components/schemas/VersioningOverride'
1446814476
description: If set, takes precedence over the Versioning Behavior sent by the SDK on Workflow Task completion.
14477+
priority:
14478+
allOf:
14479+
- $ref: '#/components/schemas/Priority'
14480+
description: If set, overrides the workflow's priority sent by the SDK.
1446914481
WorkflowExecutionOptionsUpdatedEventAttributes:
1447014482
type: object
1447114483
properties:
@@ -14481,7 +14493,7 @@ components:
1448114493
attachedRequestId:
1448214494
type: string
1448314495
description: |-
14484-
Request ID attachedto the running workflow execution so that subsequent requests with same
14496+
Request ID attached to the running workflow execution so that subsequent requests with same
1448514497
request ID will be deduped.
1448614498
attachedCompletionCallbacks:
1448714499
type: array
@@ -14491,6 +14503,12 @@ components:
1449114503
identity:
1449214504
type: string
1449314505
description: Optional. The identity of the client who initiated the request that created this event.
14506+
priority:
14507+
allOf:
14508+
- $ref: '#/components/schemas/Priority'
14509+
description: |-
14510+
Priority override upserted in this event. Represents the full priority; not just partial fields.
14511+
Ignored if nil.
1449414512
WorkflowExecutionPauseInfo:
1449514513
type: object
1449614514
properties:
@@ -14721,11 +14739,49 @@ components:
1472114739
inheritedPinnedVersion:
1472214740
allOf:
1472314741
- $ref: '#/components/schemas/WorkerDeploymentVersion'
14724-
description: "If present, the new workflow should start on this version with pinned base behavior.\n Child of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version.\n\n A new run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the\n new run's Task Queue belongs to that version.\n\n A new run initiated by workflow Cron will never inherit.\n\n A new run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time\n of retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned\n parent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version).\n\n Pinned override is inherited if Task Queue of new run is compatible with the override version.\n Override is inherited separately and takes precedence over inherited base version.\n\n Note: This field is mutually exclusive with inherited_auto_upgrade_info. \n Additionaly, versioning_override, if present, overrides this field during routing decisions."
14742+
description: |-
14743+
If present, the new workflow should start on this version with pinned base behavior.
14744+
Child of pinned parent will inherit the parent's version if the Child's Task Queue belongs to that version.
14745+
14746+
A new run initiated by workflow ContinueAsNew of pinned run, will inherit the previous run's version if the
14747+
new run's Task Queue belongs to that version.
14748+
14749+
A new run initiated by workflow Cron will never inherit.
14750+
14751+
A new run initiated by workflow Retry will only inherit if the retried run is effectively pinned at the time
14752+
of retry, and the retried run inherited a pinned version when it started (ie. it is a child of a pinned
14753+
parent, or a CaN of a pinned run, and is running on a Task Queue in the inherited version).
14754+
14755+
Pinned override is inherited if Task Queue of new run is compatible with the override version.
14756+
Override is inherited separately and takes precedence over inherited base version.
14757+
14758+
Note: This field is mutually exclusive with inherited_auto_upgrade_info.
14759+
Additionaly, versioning_override, if present, overrides this field during routing decisions.
1472514760
inheritedAutoUpgradeInfo:
1472614761
allOf:
1472714762
- $ref: '#/components/schemas/InheritedAutoUpgradeInfo'
14728-
description: "If present, the new workflow begins with AutoUpgrade behavior. Before dispatching the\n first workflow task, this field is set to the deployment version on which the parent/\n previous run was operating. This inheritance only happens when the task queues belong to\n the same deployment version. The first workflow task will then be dispatched to either\n this inherited deployment version, or the current deployment version of the task queue's\n Deployment. After the first workflow task, the effective behavior depends on worker-sent\n values in subsequent workflow tasks.\n\n Inheritance rules:\n - ContinueAsNew and child workflows: inherit AutoUpgrade behavior and deployment version\n - Cron: never inherits\n - Retry: inherits only if the retried run is effectively AutoUpgrade at the time of\n retry, and inherited AutoUpgrade behavior when it started (i.e. it is a child of an\n AutoUpgrade parent or ContinueAsNew of an AutoUpgrade run, running on the same\n deployment as the parent/previous run)\n \n Additional notes: \n - This field is mutually exclusive with `inherited_pinned_version`. \n - `versioning_override`, if present, overrides this field during routing decisions.\n - SDK implementations do not interact with this field and is only used internally by \n the server to ensure task routing correctness."
14763+
description: |-
14764+
If present, the new workflow begins with AutoUpgrade behavior. Before dispatching the
14765+
first workflow task, this field is set to the deployment version on which the parent/
14766+
previous run was operating. This inheritance only happens when the task queues belong to
14767+
the same deployment version. The first workflow task will then be dispatched to either
14768+
this inherited deployment version, or the current deployment version of the task queue's
14769+
Deployment. After the first workflow task, the effective behavior depends on worker-sent
14770+
values in subsequent workflow tasks.
14771+
14772+
Inheritance rules:
14773+
- ContinueAsNew and child workflows: inherit AutoUpgrade behavior and deployment version
14774+
- Cron: never inherits
14775+
- Retry: inherits only if the retried run is effectively AutoUpgrade at the time of
14776+
retry, and inherited AutoUpgrade behavior when it started (i.e. it is a child of an
14777+
AutoUpgrade parent or ContinueAsNew of an AutoUpgrade run, running on the same
14778+
deployment as the parent/previous run)
14779+
14780+
Additional notes:
14781+
- This field is mutually exclusive with `inherited_pinned_version`.
14782+
- `versioning_override`, if present, overrides this field during routing decisions.
14783+
- SDK implementations do not interact with this field and is only used internally by
14784+
the server to ensure task routing correctness.
1472914785
eagerExecutionAccepted:
1473014786
type: boolean
1473114787
description: |-

temporal/api/activity/v1/message.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@ message ActivityOptions {
4242
google.protobuf.Duration heartbeat_timeout = 5;
4343

4444
temporal.api.common.v1.RetryPolicy retry_policy = 6;
45+
46+
// Priority metadata. If this message is not present, or any fields are not
47+
// present, they inherit the values from the workflow.
48+
temporal.api.common.v1.Priority priority = 7;
4549
}

temporal/api/history/v1/message.proto

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ message WorkflowExecutionStartedEventAttributes {
152152
// Pinned override is inherited if Task Queue of new run is compatible with the override version.
153153
// Override is inherited separately and takes precedence over inherited base version.
154154
//
155-
// Note: This field is mutually exclusive with inherited_auto_upgrade_info.
156-
// Additionaly, versioning_override, if present, overrides this field during routing decisions.
155+
// Note: This field is mutually exclusive with inherited_auto_upgrade_info.
156+
// Additionaly, versioning_override, if present, overrides this field during routing decisions.
157157
temporal.api.deployment.v1.WorkerDeploymentVersion inherited_pinned_version = 37;
158158

159159
// If present, the new workflow begins with AutoUpgrade behavior. Before dispatching the
@@ -171,11 +171,11 @@ message WorkflowExecutionStartedEventAttributes {
171171
// retry, and inherited AutoUpgrade behavior when it started (i.e. it is a child of an
172172
// AutoUpgrade parent or ContinueAsNew of an AutoUpgrade run, running on the same
173173
// deployment as the parent/previous run)
174-
//
175-
// Additional notes:
176-
// - This field is mutually exclusive with `inherited_pinned_version`.
174+
//
175+
// Additional notes:
176+
// - This field is mutually exclusive with `inherited_pinned_version`.
177177
// - `versioning_override`, if present, overrides this field during routing decisions.
178-
// - SDK implementations do not interact with this field and is only used internally by
178+
// - SDK implementations do not interact with this field and is only used internally by
179179
// the server to ensure task routing correctness.
180180
temporal.api.deployment.v1.InheritedAutoUpgradeInfo inherited_auto_upgrade_info = 39;
181181

@@ -834,13 +834,16 @@ message WorkflowExecutionOptionsUpdatedEventAttributes {
834834
temporal.api.workflow.v1.VersioningOverride versioning_override = 1;
835835
// Versioning override removed in this event.
836836
bool unset_versioning_override = 2;
837-
// Request ID attachedto the running workflow execution so that subsequent requests with same
837+
// Request ID attached to the running workflow execution so that subsequent requests with same
838838
// request ID will be deduped.
839839
string attached_request_id = 3;
840840
// Completion callbacks attached to the running workflow execution.
841841
repeated temporal.api.common.v1.Callback attached_completion_callbacks = 4;
842842
// Optional. The identity of the client who initiated the request that created this event.
843843
string identity = 5;
844+
// Priority override upserted in this event. Represents the full priority; not just partial fields.
845+
// Ignored if nil.
846+
temporal.api.common.v1.Priority priority = 6;
844847
}
845848

846849
// Not used anywhere. Use case is replaced by WorkflowExecutionOptionsUpdatedEventAttributes

temporal/api/workflow/v1/message.proto

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ message PendingActivityInfo {
318318
// If nil, the activity has not yet been dispatched or was last dispatched to an unversioned worker.
319319
temporal.api.deployment.v1.WorkerDeploymentVersion last_deployment_version = 25;
320320

321-
322-
// Priority metadata
321+
// Priority metadata. If this message is not present, or any fields are not
322+
// present, they inherit the values from the workflow.
323323
temporal.api.common.v1.Priority priority = 22;
324324

325325
message PauseInfo {
@@ -547,6 +547,9 @@ message NexusOperationCancellationInfo {
547547
message WorkflowExecutionOptions {
548548
// If set, takes precedence over the Versioning Behavior sent by the SDK on Workflow Task completion.
549549
VersioningOverride versioning_override = 1;
550+
551+
// If set, overrides the workflow's priority sent by the SDK.
552+
temporal.api.common.v1.Priority priority = 2;
550553
}
551554

552555
// Used to override the versioning behavior (and pinned deployment version, if applicable) of a

0 commit comments

Comments
 (0)