Skip to content

Add workflow expiration and run timestamps to execution info#505

Merged
ychebotarev merged 6 commits intomasterfrom
y_desc
Dec 18, 2024
Merged

Add workflow expiration and run timestamps to execution info#505
ychebotarev merged 6 commits intomasterfrom
y_desc

Conversation

@ychebotarev
Copy link
Copy Markdown
Contributor

@ychebotarev ychebotarev commented Dec 10, 2024

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.

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)

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.

Breaking changes
No

Server PR
N/A

@ychebotarev ychebotarev requested review from a team as code owners December 10, 2024 18:15
@ychebotarev ychebotarev requested a review from cretz December 10, 2024 20:37
}

// Holds all the extra information about workflow execution.
message WorkflowExecutionExtendedInfo {
Copy link
Copy Markdown
Contributor Author

@ychebotarev ychebotarev Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, it will be a good time to ask for more info.
Example:
I'm adding cancel_requested - we want to do that for a long time, but also don't want to add it to ES

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be a good time to ask for more info

Can I have original_start_time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can.
But start time in workflowExecutionInfo ->is<- the original start time.

Copy link
Copy Markdown
Contributor

@cretz cretz Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, my mistake. From the thread before at #505 (comment), I was under the impression that whatever time was needed to add to execution_timeout to make execution_expiration_time was not available. Can we add whatever that time is? Or is execution_expiration_time always equal to start_time from execution info + execution_timeout from execution config?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whatever time was needed to add to execution_timeout to make execution_expiration_time was not available

It is NOT available right now in DescribeWorkflow response. Only "StartTime", which is basically "original_start_time"
That is why I added "last_reset_time".

In theory "execution_expiration_time" = max("start_time", "last_reset_time") + "execution_expiration_timeout"

On practice - we have a case when we still manage to make a bug with this seemingly simple expiration time calculations... :) (for activities, but in a somewhat tricky manner)

So if we have some bug, or change the way expiration time is calculated - without providing exact value it will not be visible to the user.

Thus I prefer to explicitly return "execution_expiration_time". This way we return whatever we use, right or wrong, old or new.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory "execution_expiration_time" = max("start_time", "last_reset_time") + "execution_expiration_timeout"

Great, this works for me. Nothing else blocking from my POV.

On practice - we have a case when we still manage to make a bug with this seemingly simple expiration time calculations...

I am a bit curious about this. Are you saying we have a bug today, or are you saying it's possible that "execution_expiration_time" = max("start_time", "last_reset_time") + "execution_expiration_timeout" may not always be true?

Thus I prefer to explicitly return "execution_expiration_time"

This is fine, I don't mind the redundant data, though a bit concerned about the idea that it may change or that we may introduce bugs.

}

// Holds all the extra information about workflow execution.
message WorkflowExecutionExtendedInfo {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be a good time to ask for more info

Can I have original_start_time?

}

// Holds all the extra information about workflow execution.
message WorkflowExecutionExtendedInfo {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit unclear that "info" is in visibility and "extended info" is not. Maybe at least clarify at the top of the proto so people know the difference between the two and why some fields are here and some are there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments.

@ychebotarev ychebotarev requested a review from cretz December 17, 2024 21:54
Copy link
Copy Markdown
Contributor

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you have @alexshtin or someone from server re-approve? This changed quite a bit since original approval (new type, moved out of visibility, etc).

@alexshtin
Copy link
Copy Markdown
Contributor

Yes, it looks very different from what it was. I wish we started that new WorkflowExecutionExtendedInfo message earlier.

@ychebotarev ychebotarev merged commit fd15e36 into master Dec 18, 2024
@ychebotarev ychebotarev deleted the y_desc branch December 18, 2024 19:36
stephanos pushed a commit that referenced this pull request Mar 10, 2026
_**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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants