Skip to content

Commit 98465b0

Browse files
authored
Add status to StartWorkflowExecutionResponse (#580)
_**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 field `WorkflowExecutionStatus status` to `StartWorkflowExecutionResponse`. <!-- Tell your future self why have you made these changes --> **Why?** To align Update-with-Start's behavior with a regular Update. A regular Update returns its outcome from a closed Workflow, to make Update-with-Start do the same thing, it needs to returns a successful response in that case. But that would tell the user that a running Workflow exists. To help the user distinguish whether UwS operated on a closed or running workflow, this field is introduced. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** No. <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR** temporalio/temporal#7656
1 parent e335985 commit 98465b0

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

openapi/openapiv2.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10083,7 +10083,8 @@
1008310083
"$ref": "#/definitions/v1ExecuteMultiOperationResponseResponse"
1008410084
}
1008510085
}
10086-
}
10086+
},
10087+
"description": "IMPORTANT: For [StartWorkflow, UpdateWorkflow] combination (\"Update-with-Start\") when both\n 1. the workflow update for the requested update ID has already completed, and\n 2. the workflow for the requested workflow ID has already been closed,\nthen you'll receive\n - an update response containing the update's outcome, and\n - a start response with a `status` field that reflects the workflow's current state."
1008710088
},
1008810089
"v1ExecuteMultiOperationResponseResponse": {
1008910090
"type": "object",
@@ -13782,6 +13783,10 @@
1378213783
"type": "boolean",
1378313784
"description": "If true, a new workflow was started."
1378413785
},
13786+
"status": {
13787+
"$ref": "#/definitions/v1WorkflowExecutionStatus",
13788+
"description": "Current execution status of the workflow. Typically remains WORKFLOW_EXECUTION_STATUS_RUNNING\nunless a de-dupe occurs or in specific scenarios handled within the ExecuteMultiOperation (refer to its docs)."
13789+
},
1378513790
"eagerWorkflowTask": {
1378613791
"$ref": "#/definitions/v1PollWorkflowTaskQueueResponse",
1378713792
"description": "When `request_eager_execution` is set on the `StartWorkflowExecutionRequest`, the server - if supported - will\nreturn the first workflow task to be eagerly executed.\nThe caller is expected to have a worker available to process the task."

openapi/openapiv3.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7380,6 +7380,13 @@ components:
73807380
type: array
73817381
items:
73827382
$ref: '#/components/schemas/ExecuteMultiOperationResponse_Response'
7383+
description: |-
7384+
IMPORTANT: For [StartWorkflow, UpdateWorkflow] combination ("Update-with-Start") when both
7385+
1. the workflow update for the requested update ID has already completed, and
7386+
2. the workflow for the requested workflow ID has already been closed,
7387+
then you'll receive
7388+
- an update response containing the update's outcome, and
7389+
- a start response with a `status` field that reflects the workflow's current state.
73837390
ExecuteMultiOperationResponse_Response:
73847391
type: object
73857392
properties:
@@ -11011,6 +11018,21 @@ components:
1101111018
started:
1101211019
type: boolean
1101311020
description: If true, a new workflow was started.
11021+
status:
11022+
enum:
11023+
- WORKFLOW_EXECUTION_STATUS_UNSPECIFIED
11024+
- WORKFLOW_EXECUTION_STATUS_RUNNING
11025+
- WORKFLOW_EXECUTION_STATUS_COMPLETED
11026+
- WORKFLOW_EXECUTION_STATUS_FAILED
11027+
- WORKFLOW_EXECUTION_STATUS_CANCELED
11028+
- WORKFLOW_EXECUTION_STATUS_TERMINATED
11029+
- WORKFLOW_EXECUTION_STATUS_CONTINUED_AS_NEW
11030+
- WORKFLOW_EXECUTION_STATUS_TIMED_OUT
11031+
type: string
11032+
description: |-
11033+
Current execution status of the workflow. Typically remains WORKFLOW_EXECUTION_STATUS_RUNNING
11034+
unless a de-dupe occurs or in specific scenarios handled within the ExecuteMultiOperation (refer to its docs).
11035+
format: enum
1101411036
eagerWorkflowTask:
1101511037
allOf:
1101611038
- $ref: '#/components/schemas/PollWorkflowTaskQueueResponse'

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ message StartWorkflowExecutionResponse {
221221
string run_id = 1;
222222
// If true, a new workflow was started.
223223
bool started = 3;
224+
// Current execution status of the workflow. Typically remains WORKFLOW_EXECUTION_STATUS_RUNNING
225+
// unless a de-dupe occurs or in specific scenarios handled within the ExecuteMultiOperation (refer to its docs).
226+
temporal.api.enums.v1.WorkflowExecutionStatus status = 5;
224227
// When `request_eager_execution` is set on the `StartWorkflowExecutionRequest`, the server - if supported - will
225228
// return the first workflow task to be eagerly executed.
226229
// The caller is expected to have a worker available to process the task.
@@ -1805,6 +1808,12 @@ message ExecuteMultiOperationRequest {
18051808
}
18061809
}
18071810

1811+
// IMPORTANT: For [StartWorkflow, UpdateWorkflow] combination ("Update-with-Start") when both
1812+
// 1. the workflow update for the requested update ID has already completed, and
1813+
// 2. the workflow for the requested workflow ID has already been closed,
1814+
// then you'll receive
1815+
// - an update response containing the update's outcome, and
1816+
// - a start response with a `status` field that reflects the workflow's current state.
18081817
message ExecuteMultiOperationResponse {
18091818
repeated Response responses = 1;
18101819

0 commit comments

Comments
 (0)