Skip to content

Commit

Permalink
Add root workflow execution to WorkflowExecutionStartedEventAttributes (
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigozhou authored Apr 9, 2024
1 parent f99af15 commit 268fe9c
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
8 changes: 8 additions & 0 deletions openapi/openapiv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -7848,6 +7848,10 @@
"executionDuration": {
"type": "string",
"description": "Workflow execution duration is defined as difference between close time and execution time.\nThis field is only populated if the workflow is closed."
},
"rootExecution": {
"$ref": "#/definitions/v1WorkflowExecution",
"description": "Contains information about the root workflow execution.\nThe root workflow execution is defined as follows:\n1. A workflow without parent workflow is its own root workflow.\n2. A workflow that has a parent workflow has the same root workflow as its parent workflow.\nNote: workflows continued as new or reseted may or may not have parents, check examples below.\n\nExamples:\n Scenario 1: Workflow W1 starts child workflow W2, and W2 starts child workflow W3.\n - The root workflow of all three workflows is W1.\n Scenario 2: Workflow W1 starts child workflow W2, and W2 continued as new W3.\n - The root workflow of all three workflows is W1.\n Scenario 3: Workflow W1 continued as new W2.\n - The root workflow of W1 is W1 and the root workflow of W2 is W2.\n Scenario 4: Workflow W1 starts child workflow W2, and W2 is reseted, creating W3\n - The root workflow of all three workflows is W1.\n Scenario 5: Workflow W1 is reseted, creating W2.\n - The root workflow of W1 is W1 and the root workflow of W2 is W2."
}
}
},
Expand Down Expand Up @@ -7999,6 +8003,10 @@
"$ref": "#/definitions/v1Callback"
},
"description": "Completion callbacks attached when this workflow was started."
},
"rootWorkflowExecution": {
"$ref": "#/definitions/v1WorkflowExecution",
"description": "Contains information about the root workflow execution.\nThe root workflow execution is defined as follows:\n1. A workflow without parent workflow is its own root workflow.\n2. A workflow that has a parent workflow has the same root workflow as its parent workflow.\nNote: workflows continued as new or reseted may or may not have parents, check examples below.\n\nExamples:\n Scenario 1: Workflow W1 starts child workflow W2, and W2 starts child workflow W3.\n - The root workflow of all three workflows is W1.\n Scenario 2: Workflow W1 starts child workflow W2, and W2 continued as new W3.\n - The root workflow of all three workflows is W1.\n Scenario 3: Workflow W1 continued as new W2.\n - The root workflow of W1 is W1 and the root workflow of W2 is W2.\n Scenario 4: Workflow W1 starts child workflow W2, and W2 is reseted, creating W3\n - The root workflow of all three workflows is W1.\n Scenario 5: Workflow W1 is reseted, creating W2.\n - The root workflow of W1 is W1 and the root workflow of W2 is W2."
}
},
"title": "Always the first event in workflow history"
Expand Down
42 changes: 42 additions & 0 deletions openapi/openapiv3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5766,6 +5766,27 @@ components:
description: |-
Workflow execution duration is defined as difference between close time and execution time.
This field is only populated if the workflow is closed.
rootExecution:
allOf:
- $ref: '#/components/schemas/WorkflowExecution'
description: |-
Contains information about the root workflow execution.
The root workflow execution is defined as follows:
1. A workflow without parent workflow is its own root workflow.
2. A workflow that has a parent workflow has the same root workflow as its parent workflow.
Note: workflows continued as new or reseted may or may not have parents, check examples below.
Examples:
Scenario 1: Workflow W1 starts child workflow W2, and W2 starts child workflow W3.
- The root workflow of all three workflows is W1.
Scenario 2: Workflow W1 starts child workflow W2, and W2 continued as new W3.
- The root workflow of all three workflows is W1.
Scenario 3: Workflow W1 continued as new W2.
- The root workflow of W1 is W1 and the root workflow of W2 is W2.
Scenario 4: Workflow W1 starts child workflow W2, and W2 is reseted, creating W3
- The root workflow of all three workflows is W1.
Scenario 5: Workflow W1 is reseted, creating W2.
- The root workflow of W1 is W1 and the root workflow of W2 is W2.
WorkflowExecutionSignaledEventAttributes:
type: object
properties:
Expand Down Expand Up @@ -5908,6 +5929,27 @@ components:
items:
$ref: '#/components/schemas/Callback'
description: Completion callbacks attached when this workflow was started.
rootWorkflowExecution:
allOf:
- $ref: '#/components/schemas/WorkflowExecution'
description: |-
Contains information about the root workflow execution.
The root workflow execution is defined as follows:
1. A workflow without parent workflow is its own root workflow.
2. A workflow that has a parent workflow has the same root workflow as its parent workflow.
Note: workflows continued as new or reseted may or may not have parents, check examples below.
Examples:
Scenario 1: Workflow W1 starts child workflow W2, and W2 starts child workflow W3.
- The root workflow of all three workflows is W1.
Scenario 2: Workflow W1 starts child workflow W2, and W2 continued as new W3.
- The root workflow of all three workflows is W1.
Scenario 3: Workflow W1 continued as new W2.
- The root workflow of W1 is W1 and the root workflow of W2 is W2.
Scenario 4: Workflow W1 starts child workflow W2, and W2 is reseted, creating W3
- The root workflow of all three workflows is W1.
Scenario 5: Workflow W1 is reseted, creating W2.
- The root workflow of W1 is W1 and the root workflow of W2 is W2.
description: Always the first event in workflow history
WorkflowExecutionTerminatedEventAttributes:
type: object
Expand Down
19 changes: 19 additions & 0 deletions temporal/api/history/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,25 @@ message WorkflowExecutionStartedEventAttributes {

// Completion callbacks attached when this workflow was started.
repeated temporal.api.common.v1.Callback completion_callbacks = 30;

// Contains information about the root workflow execution.
// The root workflow execution is defined as follows:
// 1. A workflow without parent workflow is its own root workflow.
// 2. A workflow that has a parent workflow has the same root workflow as its parent workflow.
// Note: workflows continued as new or reseted may or may not have parents, check examples below.
//
// Examples:
// Scenario 1: Workflow W1 starts child workflow W2, and W2 starts child workflow W3.
// - The root workflow of all three workflows is W1.
// Scenario 2: Workflow W1 starts child workflow W2, and W2 continued as new W3.
// - The root workflow of all three workflows is W1.
// Scenario 3: Workflow W1 continued as new W2.
// - The root workflow of W1 is W1 and the root workflow of W2 is W2.
// Scenario 4: Workflow W1 starts child workflow W2, and W2 is reseted, creating W3
// - The root workflow of all three workflows is W1.
// Scenario 5: Workflow W1 is reseted, creating W2.
// - The root workflow of W1 is W1 and the root workflow of W2 is W2.
temporal.api.common.v1.WorkflowExecution root_workflow_execution = 31;
}

message WorkflowExecutionCompletedEventAttributes {
Expand Down
18 changes: 18 additions & 0 deletions temporal/api/workflow/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,24 @@ message WorkflowExecutionInfo {
// Workflow execution duration is defined as difference between close time and execution time.
// This field is only populated if the workflow is closed.
google.protobuf.Duration execution_duration = 17;
// Contains information about the root workflow execution.
// The root workflow execution is defined as follows:
// 1. A workflow without parent workflow is its own root workflow.
// 2. A workflow that has a parent workflow has the same root workflow as its parent workflow.
// Note: workflows continued as new or reseted may or may not have parents, check examples below.
//
// Examples:
// Scenario 1: Workflow W1 starts child workflow W2, and W2 starts child workflow W3.
// - The root workflow of all three workflows is W1.
// Scenario 2: Workflow W1 starts child workflow W2, and W2 continued as new W3.
// - The root workflow of all three workflows is W1.
// Scenario 3: Workflow W1 continued as new W2.
// - The root workflow of W1 is W1 and the root workflow of W2 is W2.
// Scenario 4: Workflow W1 starts child workflow W2, and W2 is reseted, creating W3
// - The root workflow of all three workflows is W1.
// Scenario 5: Workflow W1 is reseted, creating W2.
// - The root workflow of W1 is W1 and the root workflow of W2 is W2.
temporal.api.common.v1.WorkflowExecution root_execution = 18;
}

message WorkflowExecutionConfig {
Expand Down

0 comments on commit 268fe9c

Please sign in to comment.