Skip to content

Commit e244d68

Browse files
authored
Define post reset operations (#581)
1 parent 9acf6f1 commit e244d68

File tree

5 files changed

+192
-6
lines changed

5 files changed

+192
-6
lines changed

openapi/openapiv2.json

Lines changed: 73 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6807,6 +6807,46 @@
68076807
}
68086808
}
68096809
},
6810+
"PostResetOperationSignalWorkflow": {
6811+
"type": "object",
6812+
"properties": {
6813+
"signalName": {
6814+
"type": "string",
6815+
"description": "The workflow author-defined name of the signal to send to the workflow."
6816+
},
6817+
"input": {
6818+
"$ref": "#/definitions/v1Payloads",
6819+
"description": "Serialized value(s) to provide with the signal."
6820+
},
6821+
"header": {
6822+
"$ref": "#/definitions/v1Header",
6823+
"description": "Headers that are passed with the signal to the processing workflow."
6824+
},
6825+
"links": {
6826+
"type": "array",
6827+
"items": {
6828+
"type": "object",
6829+
"$ref": "#/definitions/apicommonv1Link"
6830+
},
6831+
"description": "Links to be associated with the WorkflowExecutionSignaled event."
6832+
}
6833+
},
6834+
"description": "SignalWorkflow represents sending a signal after a workflow reset.\nKeep the parameter in sync with temporal.api.workflowservice.v1.SignalWorkflowExecutionRequest."
6835+
},
6836+
"PostResetOperationUpdateWorkflowOptions": {
6837+
"type": "object",
6838+
"properties": {
6839+
"workflowExecutionOptions": {
6840+
"$ref": "#/definitions/v1WorkflowExecutionOptions",
6841+
"description": "Update Workflow options that were originally specified via StartWorkflowExecution. Partial updates are accepted and controlled by update_mask."
6842+
},
6843+
"updateMask": {
6844+
"type": "string",
6845+
"description": "Controls which fields from `workflow_execution_options` will be applied.\nTo unset a field, set it to null and use the update mask to indicate that it should be mutated."
6846+
}
6847+
},
6848+
"description": "UpdateWorkflowOptions represents updating workflow execution options after a workflow reset.\nKeep the parameters in sync with temporal.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest."
6849+
},
68106850
"StartOperationResponseAsync": {
68116851
"type": "object",
68126852
"properties": {
@@ -7309,6 +7349,14 @@
73097349
"$ref": "#/definitions/v1ResetReapplyExcludeType"
73107350
},
73117351
"title": "Event types not to be reapplied"
7352+
},
7353+
"postResetOperations": {
7354+
"type": "array",
7355+
"items": {
7356+
"type": "object",
7357+
"$ref": "#/definitions/v1PostResetOperation"
7358+
},
7359+
"title": "Operations to perform after the workflow has been reset. These operations will be applied\nto the *new* run of the workflow execution in the order they are provided.\nAll operations are applied to the workflow before the first new workflow task is generated"
73127360
}
73137361
}
73147362
},
@@ -7693,7 +7741,8 @@
76937741
},
76947742
"description": "Links to be associated with the WorkflowExecutionSignaled event."
76957743
}
7696-
}
7744+
},
7745+
"description": "Keep the parameters in sync with:\n - temporal.api.batch.v1.BatchOperationSignal.\n - temporal.api.workflow.v1.PostResetOperation.SignalWorkflow."
76977746
},
76987747
"WorkflowServiceStartBatchOperationBody": {
76997748
"type": "object",
@@ -8126,7 +8175,8 @@
81268175
"type": "string",
81278176
"description": "Controls which fields from `workflow_execution_options` will be applied.\nTo unset a field, set it to null and use the update mask to indicate that it should be mutated."
81288177
}
8129-
}
8178+
},
8179+
"description": "Keep the parameters in sync with:\n - temporal.api.batch.v1.BatchOperationUpdateWorkflowExecutionOptions.\n - temporal.api.workflow.v1.PostResetOperation.UpdateWorkflowOptions."
81308180
},
81318181
"apicommonv1Link": {
81328182
"type": "object",
@@ -8755,6 +8805,14 @@
87558805
"resetReapplyType": {
87568806
"$ref": "#/definitions/v1ResetReapplyType",
87578807
"description": "History event reapply options (deprecated, use `options`)."
8808+
},
8809+
"postResetOperations": {
8810+
"type": "array",
8811+
"items": {
8812+
"type": "object",
8813+
"$ref": "#/definitions/v1PostResetOperation"
8814+
},
8815+
"title": "Operations to perform after the workflow has been reset. These operations will be applied\nto the *new* run of the workflow execution in the order they are provided.\nAll operations are applied to the workflow before the first new workflow task is generated"
87588816
}
87598817
},
87608818
"description": "BatchOperationReset sends reset requests to batch workflows.\nKeep the parameter in sync with temporal.api.workflowservice.v1.ResetWorkflowExecutionRequest."
@@ -8855,7 +8913,7 @@
88558913
},
88568914
"workflowExecutionOptions": {
88578915
"$ref": "#/definitions/v1WorkflowExecutionOptions",
8858-
"description": "Workflow Execution options. Partial updates are accepted and controlled by update_mask."
8916+
"description": "Update Workflow options that were originally specified via StartWorkflowExecution. Partial updates are accepted and controlled by update_mask."
88598917
},
88608918
"updateMask": {
88618919
"type": "string",
@@ -12103,6 +12161,18 @@
1210312161
},
1210412162
"description": "Attached to task responses to give hints to the SDK about how it may adjust its number of\npollers."
1210512163
},
12164+
"v1PostResetOperation": {
12165+
"type": "object",
12166+
"properties": {
12167+
"signalWorkflow": {
12168+
"$ref": "#/definitions/PostResetOperationSignalWorkflow"
12169+
},
12170+
"updateWorkflowOptions": {
12171+
"$ref": "#/definitions/PostResetOperationUpdateWorkflowOptions"
12172+
}
12173+
},
12174+
"description": "PostResetOperation represents an operation to be performed on the new workflow execution after a workflow reset."
12175+
},
1210612176
"v1Priority": {
1210712177
"type": "object",
1210812178
"properties": {

openapi/openapiv3.yaml

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6309,6 +6309,14 @@ components:
63096309
type: string
63106310
description: History event reapply options (deprecated, use `options`).
63116311
format: enum
6312+
postResetOperations:
6313+
type: array
6314+
items:
6315+
$ref: '#/components/schemas/PostResetOperation'
6316+
description: |-
6317+
Operations to perform after the workflow has been reset. These operations will be applied
6318+
to the *new* run of the workflow execution in the order they are provided.
6319+
All operations are applied to the workflow before the first new workflow task is generated
63126320
description: |-
63136321
BatchOperationReset sends reset requests to batch workflows.
63146322
Keep the parameter in sync with temporal.api.workflowservice.v1.ResetWorkflowExecutionRequest.
@@ -6380,7 +6388,7 @@ components:
63806388
workflowExecutionOptions:
63816389
allOf:
63826390
- $ref: '#/components/schemas/WorkflowExecutionOptions'
6383-
description: Workflow Execution options. Partial updates are accepted and controlled by update_mask.
6391+
description: Update Workflow options that were originally specified via StartWorkflowExecution. Partial updates are accepted and controlled by update_mask.
63846392
updateMask:
63856393
type: string
63866394
description: |-
@@ -9115,6 +9123,52 @@ components:
91159123
description: |-
91169124
Attached to task responses to give hints to the SDK about how it may adjust its number of
91179125
pollers.
9126+
PostResetOperation:
9127+
type: object
9128+
properties:
9129+
signalWorkflow:
9130+
$ref: '#/components/schemas/PostResetOperation_SignalWorkflow'
9131+
updateWorkflowOptions:
9132+
$ref: '#/components/schemas/PostResetOperation_UpdateWorkflowOptions'
9133+
description: PostResetOperation represents an operation to be performed on the new workflow execution after a workflow reset.
9134+
PostResetOperation_SignalWorkflow:
9135+
type: object
9136+
properties:
9137+
signalName:
9138+
type: string
9139+
description: The workflow author-defined name of the signal to send to the workflow.
9140+
input:
9141+
allOf:
9142+
- $ref: '#/components/schemas/Payloads'
9143+
description: Serialized value(s) to provide with the signal.
9144+
header:
9145+
allOf:
9146+
- $ref: '#/components/schemas/Header'
9147+
description: Headers that are passed with the signal to the processing workflow.
9148+
links:
9149+
type: array
9150+
items:
9151+
$ref: '#/components/schemas/Link'
9152+
description: Links to be associated with the WorkflowExecutionSignaled event.
9153+
description: |-
9154+
SignalWorkflow represents sending a signal after a workflow reset.
9155+
Keep the parameter in sync with temporal.api.workflowservice.v1.SignalWorkflowExecutionRequest.
9156+
PostResetOperation_UpdateWorkflowOptions:
9157+
type: object
9158+
properties:
9159+
workflowExecutionOptions:
9160+
allOf:
9161+
- $ref: '#/components/schemas/WorkflowExecutionOptions'
9162+
description: Update Workflow options that were originally specified via StartWorkflowExecution. Partial updates are accepted and controlled by update_mask.
9163+
updateMask:
9164+
type: string
9165+
description: |-
9166+
Controls which fields from `workflow_execution_options` will be applied.
9167+
To unset a field, set it to null and use the update mask to indicate that it should be mutated.
9168+
format: field-mask
9169+
description: |-
9170+
UpdateWorkflowOptions represents updating workflow execution options after a workflow reset.
9171+
Keep the parameters in sync with temporal.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest.
91189172
Priority:
91199173
type: object
91209174
properties:
@@ -9692,6 +9746,14 @@ components:
96929746
type: string
96939747
format: enum
96949748
description: Event types not to be reapplied
9749+
postResetOperations:
9750+
type: array
9751+
items:
9752+
$ref: '#/components/schemas/PostResetOperation'
9753+
description: |-
9754+
Operations to perform after the workflow has been reset. These operations will be applied
9755+
to the *new* run of the workflow execution in the order they are provided.
9756+
All operations are applied to the workflow before the first new workflow task is generated
96959757
ResetWorkflowExecutionResponse:
96969758
type: object
96979759
properties:
@@ -10732,6 +10794,10 @@ components:
1073210794
items:
1073310795
$ref: '#/components/schemas/Link'
1073410796
description: Links to be associated with the WorkflowExecutionSignaled event.
10797+
description: |-
10798+
Keep the parameters in sync with:
10799+
- temporal.api.batch.v1.BatchOperationSignal.
10800+
- temporal.api.workflow.v1.PostResetOperation.SignalWorkflow.
1073510801
SignalWorkflowExecutionResponse:
1073610802
type: object
1073710803
properties: {}
@@ -11746,6 +11812,10 @@ components:
1174611812
Controls which fields from `workflow_execution_options` will be applied.
1174711813
To unset a field, set it to null and use the update mask to indicate that it should be mutated.
1174811814
format: field-mask
11815+
description: |-
11816+
Keep the parameters in sync with:
11817+
- temporal.api.batch.v1.BatchOperationUpdateWorkflowExecutionOptions.
11818+
- temporal.api.workflow.v1.PostResetOperation.UpdateWorkflowOptions.
1174911819
UpdateWorkflowExecutionOptionsResponse:
1175011820
type: object
1175111821
properties:

temporal/api/batch/v1/message.proto

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ message BatchOperationReset {
8181
temporal.api.enums.v1.ResetType reset_type = 1;
8282
// History event reapply options (deprecated, use `options`).
8383
temporal.api.enums.v1.ResetReapplyType reset_reapply_type = 2;
84-
84+
// Operations to perform after the workflow has been reset. These operations will be applied
85+
// to the *new* run of the workflow execution in the order they are provided.
86+
// All operations are applied to the workflow before the first new workflow task is generated
87+
repeated temporal.api.workflow.v1.PostResetOperation post_reset_operations = 5;
8588
}
8689

8790
// BatchOperationUpdateWorkflowExecutionOptions sends UpdateWorkflowExecutionOptions requests to batch workflows.
@@ -90,7 +93,7 @@ message BatchOperationUpdateWorkflowExecutionOptions {
9093
// The identity of the worker/client.
9194
string identity = 1;
9295

93-
// Workflow Execution options. Partial updates are accepted and controlled by update_mask.
96+
// Update Workflow options that were originally specified via StartWorkflowExecution. Partial updates are accepted and controlled by update_mask.
9497
temporal.api.workflow.v1.WorkflowExecutionOptions workflow_execution_options = 2;
9598

9699
// Controls which fields from `workflow_execution_options` will be applied.

temporal/api/workflow/v1/message.proto

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ option csharp_namespace = "Temporalio.Api.Workflow.V1";
1212
import "google/protobuf/duration.proto";
1313
import "google/protobuf/empty.proto";
1414
import "google/protobuf/timestamp.proto";
15+
import "google/protobuf/field_mask.proto";
1516

1617
import "temporal/api/enums/v1/common.proto";
1718
import "temporal/api/enums/v1/event_type.proto";
@@ -559,3 +560,35 @@ message RequestIdInfo {
559560
// will be an invalid event ID.
560561
bool buffered = 3;
561562
}
563+
564+
// PostResetOperation represents an operation to be performed on the new workflow execution after a workflow reset.
565+
message PostResetOperation {
566+
// SignalWorkflow represents sending a signal after a workflow reset.
567+
// Keep the parameter in sync with temporal.api.workflowservice.v1.SignalWorkflowExecutionRequest.
568+
message SignalWorkflow {
569+
// The workflow author-defined name of the signal to send to the workflow.
570+
string signal_name = 1;
571+
// Serialized value(s) to provide with the signal.
572+
temporal.api.common.v1.Payloads input = 2;
573+
// Headers that are passed with the signal to the processing workflow.
574+
temporal.api.common.v1.Header header = 3;
575+
// Links to be associated with the WorkflowExecutionSignaled event.
576+
repeated temporal.api.common.v1.Link links = 4;
577+
}
578+
579+
// UpdateWorkflowOptions represents updating workflow execution options after a workflow reset.
580+
// Keep the parameters in sync with temporal.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest.
581+
message UpdateWorkflowOptions {
582+
// Update Workflow options that were originally specified via StartWorkflowExecution. Partial updates are accepted and controlled by update_mask.
583+
temporal.api.workflow.v1.WorkflowExecutionOptions workflow_execution_options = 1;
584+
// Controls which fields from `workflow_execution_options` will be applied.
585+
// To unset a field, set it to null and use the update mask to indicate that it should be mutated.
586+
google.protobuf.FieldMask update_mask = 2;
587+
}
588+
589+
oneof variant {
590+
SignalWorkflow signal_workflow = 1;
591+
UpdateWorkflowOptions update_workflow_options = 2;
592+
}
593+
}
594+

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,9 @@ message RequestCancelWorkflowExecutionRequest {
697697
message RequestCancelWorkflowExecutionResponse {
698698
}
699699

700+
// Keep the parameters in sync with:
701+
// - temporal.api.batch.v1.BatchOperationSignal.
702+
// - temporal.api.workflow.v1.PostResetOperation.SignalWorkflow.
700703
message SignalWorkflowExecutionRequest {
701704
string namespace = 1;
702705
temporal.api.common.v1.WorkflowExecution workflow_execution = 2;
@@ -809,6 +812,10 @@ message ResetWorkflowExecutionRequest {
809812
temporal.api.enums.v1.ResetReapplyType reset_reapply_type = 6;
810813
// Event types not to be reapplied
811814
repeated temporal.api.enums.v1.ResetReapplyExcludeType reset_reapply_exclude_types = 7;
815+
// Operations to perform after the workflow has been reset. These operations will be applied
816+
// to the *new* run of the workflow execution in the order they are provided.
817+
// All operations are applied to the workflow before the first new workflow task is generated
818+
repeated temporal.api.workflow.v1.PostResetOperation post_reset_operations = 8;
812819
}
813820

814821
message ResetWorkflowExecutionResponse {
@@ -1928,6 +1935,9 @@ message ResetActivityRequest {
19281935
message ResetActivityResponse {
19291936
}
19301937

1938+
// Keep the parameters in sync with:
1939+
// - temporal.api.batch.v1.BatchOperationUpdateWorkflowExecutionOptions.
1940+
// - temporal.api.workflow.v1.PostResetOperation.UpdateWorkflowOptions.
19311941
message UpdateWorkflowExecutionOptionsRequest {
19321942
// The namespace name of the target Workflow.
19331943
string namespace = 1;

0 commit comments

Comments
 (0)