From 1032e592859efe9bd5eaec32eae57547681775c4 Mon Sep 17 00:00:00 2001 From: rodrigozhou Date: Wed, 20 Mar 2024 17:08:30 -0600 Subject: [PATCH] Add root workflow execution to WorkflowExecutionStartedEventAttributes --- openapi/openapiv2.json | 7 +++++++ openapi/openapiv3.yaml | 23 +++++++++++++++++++++++ temporal/api/history/v1/message.proto | 19 +++++++++++++++++++ temporal/api/workflow/v1/message.proto | 1 + 4 files changed, 50 insertions(+) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 82d9d6c73..680c0b11e 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -7786,6 +7786,9 @@ "mostRecentWorkerVersionStamp": { "$ref": "#/definitions/v1WorkerVersionStamp", "title": "If set, the most recent worker version stamp that appeared in a workflow task completion" + }, + "rootExecution": { + "$ref": "#/definitions/v1WorkflowExecution" } } }, @@ -7937,6 +7940,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" diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index d0e15256d..e4b91eb6e 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -5755,6 +5755,8 @@ components: allOf: - $ref: '#/components/schemas/WorkerVersionStamp' description: If set, the most recent worker version stamp that appeared in a workflow task completion + rootExecution: + $ref: '#/components/schemas/WorkflowExecution' WorkflowExecutionSignaledEventAttributes: type: object properties: @@ -5897,6 +5899,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 diff --git a/temporal/api/history/v1/message.proto b/temporal/api/history/v1/message.proto index da795e164..8e0016439 100644 --- a/temporal/api/history/v1/message.proto +++ b/temporal/api/history/v1/message.proto @@ -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 { diff --git a/temporal/api/workflow/v1/message.proto b/temporal/api/workflow/v1/message.proto index 4c5e98d6b..d98a67d8b 100644 --- a/temporal/api/workflow/v1/message.proto +++ b/temporal/api/workflow/v1/message.proto @@ -58,6 +58,7 @@ message WorkflowExecutionInfo { int64 history_size_bytes = 15; // If set, the most recent worker version stamp that appeared in a workflow task completion temporal.api.common.v1.WorkerVersionStamp most_recent_worker_version_stamp = 16; + temporal.api.common.v1.WorkflowExecution root_execution = 17; } message WorkflowExecutionConfig {