Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Workflow docs editing #6571

Merged
merged 12 commits into from
Oct 2, 2024
Merged

Conversation

stephanos
Copy link
Contributor

@stephanos stephanos commented Sep 27, 2024

What changed?

Edited remaining Update Workflow docs not already covered by #6486.

@stephanos stephanos force-pushed the update-docs-editing branch 6 times, most recently from caaf58e to a7268d3 Compare September 27, 2024 17:06
@stephanos stephanos marked this pull request as ready for review September 27, 2024 17:33
@stephanos stephanos requested a review from a team as a code owner September 27, 2024 17:33
Comment on lines 12 to 13
The in-memory queue only supports `WorkflowTaskTimeoutTask` and it only enforces
`SCHEDULED_TO_START` and `START_TO_CLOSE`.
Copy link
Member

Choose a reason for hiding this comment

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

There are only two timeout types for any WFT. My intent here was to emphasize that only one type of timer tasks (WorkflowTaskTimeoutTask) is supported which enforce both timeouts. In your version, it sounds like normal WFT has other timeouts but for speculative we have only these 2.

Copy link
Contributor Author

@stephanos stephanos Oct 1, 2024

Choose a reason for hiding this comment

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

what's the other timeout type?

Copy link
Member

Choose a reason for hiding this comment

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

For activity tasks there is also SCHEDULE_TO_CLOSE which is for all attempts. WFT doesn't have it, it is getting retried forever.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha! Changed it to this now:

The in-memory queue only supports WorkflowTaskTimeoutTask, and enforces the
SCHEDULE_TO_START and START_TO_CLOSE timeouts.


> #### TODO
> In fact, this is not used. Server always set `event_id` equal to event Id before `WorkflowTaskStartedEvent`,
Copy link
Member

Choose a reason for hiding this comment

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

I think it is important to indicate that this field is not currently used at all. Yes, from your version it kinda implies that, but I would like to see clear sentence saying "it doesn't work this way".

Copy link
Contributor Author

@stephanos stephanos Oct 1, 2024

Choose a reason for hiding this comment

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

I think I found the "not used part" confusing. It sounds like the worker isn't using the field? I've updated the text now.

Copy link
Member

Choose a reason for hiding this comment

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

I see. Yes, event_id is set by server and respected by all SDK. It just set not to intended value. command_index though is indeed not used at all: it is not set by SDKs (at least go) and not checked by server.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense 👍

When Workflow Task finally completes, `WorkflowTaskScheduled` and `WorkflowTaskStarted` events
are getting written to history followed by `WorklfowTaskCompleted` event.
Every Workflow Task ships history events to the worker. It must always contain the two events
`WorkflowTaskScheduled` and `WorkflowTaskStarted`. There might be some events in-between them if
Copy link
Member

Choose a reason for hiding this comment

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

I believe it is important to say that WFTStarted must be the last (not just contains).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed that part because the very next sentence contradicts the original statement that the last two events are WFTScheduled and WFTStarted. I'll change it to emphasize that WFTStart must be last.

the server writes a corresponding Workflow Task failed event to the history and increases the
attempt count in the mutable state.

For the next attempt, a **transient Workflow Task** is used: the Workflow Task events
Copy link
Member

Choose a reason for hiding this comment

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

So... the is idea here was that there is no such thing as transient WFT. All WFT are the same. There are transient events. And we call WFT with such events "transient WFT" just for convenience instead of saying "WFT with transient events". I think this idea is lost in your version, although it still describes it pretty well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 I'll clarify

the response from the `RecordWorkflowTaskStarted` API. The worker does not know they are transient,
though. If the Workflow Task keeps failing, the attempt counter is increased in the mutable state,
and transient Workflow Task events are created again - but no new failure event is written into the
history again. When the Workflow Task finally completes, the `WorkflowTaskScheduled` and
Copy link
Member

Choose a reason for hiding this comment

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

Now you removed transient WFT completely :-). But we do use this name in code and comments. I would add an original sentence here:

Workflow Task, which has transient Workflow Task events, is called ***transient Workflow Task***.

@alexshtin
Copy link
Member

Thanks for clearing and clarifying everything in the docs.

@stephanos stephanos enabled auto-merge (squash) October 2, 2024 16:43
@stephanos stephanos merged commit fda585c into temporalio:main Oct 2, 2024
46 checks passed
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.

3 participants