Skip to content

Commit

Permalink
Add workflow expiration and run timestamps to execution info (#505)
Browse files Browse the repository at this point in the history
_**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?**
Add new structure -WorkflowExecutionExtendedInfo

That structure has few fields:
* execution timeout time
* run timeout time
* last reset time
* cancel requested

(the last one from #339)

<!-- Tell your future self why have you made these changes -->
**Why?**
Per customer request.
Execution timeout timestamp may change after workflow reset, and in this
case customers have no idea when it will fire.
WorkflowExecutionInfo is reused in other server calls, like
ListWorkflow, etc.
Because of that we either add any new field to ES, or it will be nil
which is bad user experience.

<!-- 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**
N/A
  • Loading branch information
ychebotarev authored Dec 18, 2024
1 parent 38d2ac0 commit fd15e36
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 1 deletion.
36 changes: 35 additions & 1 deletion openapi/openapiv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -8466,6 +8466,9 @@
"type": "object",
"$ref": "#/definitions/v1PendingNexusOperationInfo"
}
},
"workflowExtendedInfo": {
"$ref": "#/definitions/v1WorkflowExecutionExtendedInfo"
}
}
},
Expand Down Expand Up @@ -12901,6 +12904,36 @@
}
}
},
"v1WorkflowExecutionExtendedInfo": {
"type": "object",
"properties": {
"executionExpirationTime": {
"type": "string",
"format": "date-time",
"description": "Workflow execution expiration time is defined as workflow start time plus expiration timeout.\nWorkflow start time may change after workflow reset."
},
"runExpirationTime": {
"type": "string",
"format": "date-time",
"description": "Workflow run expiration time is defined as current workflow run start time plus workflow run timeout."
},
"cancelRequested": {
"type": "boolean",
"title": "indicates if the workflow received a cancel request"
},
"lastResetTime": {
"type": "string",
"format": "date-time",
"description": "Last workflow reset time. Nil if the workflow was never reset."
},
"originalStartTime": {
"type": "string",
"format": "date-time",
"description": "Original workflow start time."
}
},
"description": "Holds all the extra information about workflow execution that is not part of Visibility."
},
"v1WorkflowExecutionFailedEventAttributes": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -13015,7 +13048,8 @@
"$ref": "#/definitions/v1WorkflowExecutionVersioningInfo",
"description": "Absent value means the workflow execution is not versioned. When present, the execution might\nbe versioned or unversioned, depending on `versioning_info.behavior` and `versioning_info.versioning_override`.\nExperimental. Versioning info is experimental and might change in the future."
}
}
},
"description": "Hold basic information about a workflow execution.\nThis structure is a part of visibility, and thus contain a limited subset of information."
},
"v1WorkflowExecutionOptions": {
"type": "object",
Expand Down
30 changes: 30 additions & 0 deletions openapi/openapiv3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6157,6 +6157,8 @@ components:
type: array
items:
$ref: '#/components/schemas/PendingNexusOperationInfo'
workflowExtendedInfo:
$ref: '#/components/schemas/WorkflowExecutionExtendedInfo'
Endpoint:
type: object
properties:
Expand Down Expand Up @@ -10390,6 +10392,31 @@ components:
description: |-
If this is set, the new execution inherits the Build ID of the current execution. Otherwise,
the assignment rules will be used to independently assign a Build ID to the new execution.
WorkflowExecutionExtendedInfo:
type: object
properties:
executionExpirationTime:
type: string
description: |-
Workflow execution expiration time is defined as workflow start time plus expiration timeout.
Workflow start time may change after workflow reset.
format: date-time
runExpirationTime:
type: string
description: Workflow run expiration time is defined as current workflow run start time plus workflow run timeout.
format: date-time
cancelRequested:
type: boolean
description: indicates if the workflow received a cancel request
lastResetTime:
type: string
description: Last workflow reset time. Nil if the workflow was never reset.
format: date-time
originalStartTime:
type: string
description: Original workflow start time.
format: date-time
description: Holds all the extra information about workflow execution that is not part of Visibility.
WorkflowExecutionFailedEventAttributes:
type: object
properties:
Expand Down Expand Up @@ -10526,6 +10553,9 @@ components:
Absent value means the workflow execution is not versioned. When present, the execution might
be versioned or unversioned, depending on `versioning_info.behavior` and `versioning_info.versioning_override`.
Experimental. Versioning info is experimental and might change in the future.
description: |-
Hold basic information about a workflow execution.
This structure is a part of visibility, and thus contain a limited subset of information.
WorkflowExecutionOptions:
type: object
properties:
Expand Down
22 changes: 22 additions & 0 deletions temporal/api/workflow/v1/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ import "temporal/api/failure/v1/message.proto";
import "temporal/api/taskqueue/v1/message.proto";
import "temporal/api/sdk/v1/user_metadata.proto";


// Hold basic information about a workflow execution.
// This structure is a part of visibility, and thus contain a limited subset of information.
message WorkflowExecutionInfo {
temporal.api.common.v1.WorkflowExecution execution = 1;
temporal.api.common.v1.WorkflowType type = 2;
Expand Down Expand Up @@ -109,6 +112,25 @@ message WorkflowExecutionInfo {
WorkflowExecutionVersioningInfo versioning_info = 22;
}

// Holds all the extra information about workflow execution that is not part of Visibility.
message WorkflowExecutionExtendedInfo {
// Workflow execution expiration time is defined as workflow start time plus expiration timeout.
// Workflow start time may change after workflow reset.
google.protobuf.Timestamp execution_expiration_time = 1;

// Workflow run expiration time is defined as current workflow run start time plus workflow run timeout.
google.protobuf.Timestamp run_expiration_time = 2;

// indicates if the workflow received a cancel request
bool cancel_requested = 3;

// Last workflow reset time. Nil if the workflow was never reset.
google.protobuf.Timestamp last_reset_time = 4;

// Original workflow start time.
google.protobuf.Timestamp original_start_time = 5;
}

// Holds all the information about versioning for a workflow execution.
// Experimental. Versioning info is experimental and might change in the future.
message WorkflowExecutionVersioningInfo {
Expand Down
1 change: 1 addition & 0 deletions temporal/api/workflowservice/v1/request_response.proto
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,7 @@ message DescribeWorkflowExecutionResponse {
temporal.api.workflow.v1.PendingWorkflowTaskInfo pending_workflow_task = 5;
repeated temporal.api.workflow.v1.CallbackInfo callbacks = 6;
repeated temporal.api.workflow.v1.PendingNexusOperationInfo pending_nexus_operations = 7;
temporal.api.workflow.v1.WorkflowExecutionExtendedInfo workflow_extended_info = 8;
}

// (-- api-linter: core::0203::optional=disabled
Expand Down

0 comments on commit fd15e36

Please sign in to comment.