Add more diagram for workflow lifecycle doc (#8302)

## What changed?
- Add diagrams for server side states as workflows make progress
This commit is contained in:
Yichao Yang
2025-09-09 14:59:57 -07:00
committed by GitHub
parent 707b2aa2bc
commit ab16da6051

View File

@@ -37,6 +37,47 @@ loop QueueProcessor
end
```
```mermaid
---
config:
layout: elk
---
flowchart LR
subgraph left["&nbsp"]
direction TB
subgraph ms[Mutable State]
direction TB
ms1["Workflow Task: Scheduled"]
end
subgraph transferQ[Transfer Queue]
direction LR
transfer1("WorkflowTask")
end
subgraph timerQ[Timer Queue]
direction LR
timer1("Workflow Timeout")
end
ms ~~~ transferQ ~~~ timerQ
end
subgraph history[Workflow History]
direction TB
e1[WorkflowExecutionStarted] ~~~
e2[WorkflowTaskScheduled]
end
left ~~~ history
style left fill:transparent,stroke:transparent
```
<details>
<summary><i>Code entrypoints</i></summary>
@@ -70,6 +111,50 @@ Frontend->>Worker: WorkflowTask
Worker->>Worker: Advance workflow
```
```mermaid
---
config:
layout: elk
---
flowchart LR
subgraph left["&nbsp"]
direction TB
subgraph ms[Mutable State]
direction TB
ms1["Workflow Task: Started"]
end
subgraph transferQ[Transfer Queue]
direction LR
transfer1("&nbsp")
end
subgraph timerQ[Timer Queue]
direction LR
timer1("Workflow Task Timeout") ~~~
timer2("Workflow Timeout")
end
ms ~~~ transferQ ~~~ timerQ
end
subgraph history[Workflow History]
direction TB
e1[WorkflowExecutionStarted] ~~~
e2[WorkflowTaskScheduled] ~~~
e3[WorkflowTaskStarted]
end
left ~~~ history
style left fill:transparent,stroke:transparent
```
<details>
<summary><i>Code entrypoints</i></summary>
@@ -101,6 +186,54 @@ loop QueueProcessor
end
```
```mermaid
---
config:
layout: elk
---
flowchart LR
subgraph left["&nbsp"]
direction TB
subgraph ms[Mutable State]
direction TB
ms1["Workflow Task: Empty"] ~~~
ms2["Activity Task: Scheduled"]
end
subgraph transferQ[Transfer Queue]
direction LR
transfer1("Activity Task")
end
subgraph timerQ[Timer Queue]
direction LR
timer1("Workflow Task Timeout") ~~~
timer2("Activity Task Timeout") ~~~
timer3("Workflow Timeout")
end
ms ~~~ transferQ ~~~ timerQ
end
subgraph history[Workflow History]
direction TB
e1[WorkflowExecutionStarted] ~~~
e2[WorkflowTaskScheduled] ~~~
e3[WorkflowTaskStarted] ~~~
e4[WorkflowTaskCompleted] ~~~
e5[ActivityTaskScheduled]
end
left ~~~ history
style left fill:transparent,stroke:transparent
```
<details>
<summary><i>Code entrypoints</i></summary>
@@ -130,6 +263,55 @@ Frontend->>Worker: ActivityTask
Worker->>Worker: Execute activity
```
```mermaid
---
config:
layout: elk
---
flowchart LR
subgraph left["&nbsp"]
direction TB
subgraph ms[Mutable State]
direction TB
ms1["Workflow Task: Empty"] ~~~
ms2["Activity Task: Started"]
end
subgraph transferQ[Transfer Queue]
direction LR
transfer1("&nbsp")
end
subgraph timerQ[Timer Queue]
direction LR
timer1("Activity Task Timeout") ~~~
timer2("Workflow Timeout")
end
ms ~~~ transferQ ~~~ timerQ
end
subgraph history[Workflow History]
classDef dottedBoxStyle stroke-dasharray: 5 5;
direction TB
e1[WorkflowExecutionStarted] ~~~
e2[WorkflowTaskScheduled] ~~~
e3[WorkflowTaskStarted] ~~~
e4[WorkflowTaskCompleted] ~~~
e5[ActivityTaskScheduled] ~~~
e6[ActivityTaskStarted]:::dottedBoxStyle
end
left ~~~ history
style left fill:transparent,stroke:transparent
```
<details>
<summary><i>Code entrypoints</i></summary>
@@ -161,6 +343,56 @@ loop QueueProcessor
end
```
```mermaid
---
config:
layout: elk
---
flowchart LR
subgraph left["&nbsp"]
direction TB
subgraph ms[Mutable State]
direction TB
ms1["Workflow Task: Empty"]
end
subgraph transferQ[Transfer Queue]
direction LR
transfer1("Workflow Task")
end
subgraph timerQ[Timer Queue]
direction LR
timer1("Workflow Task Timeout") ~~~
timer2("Activity Task Timeout") ~~~
timer3("Workflow Timeout")
end
ms ~~~ transferQ ~~~ timerQ
end
subgraph history[Workflow History]
direction TB
e1[WorkflowExecutionStarted] ~~~
e2[WorkflowTaskScheduled] ~~~
e3[WorkflowTaskStarted] ~~~
e4[WorkflowTaskCompleted] ~~~
e5[ActivityTaskScheduled] ~~~
e6[ActivityTaskStarted] ~~~
e7[ActivityTaskCompleted] ~~~
e8[WorkflowTaskScheduled]
end
left ~~~ history
style left fill:transparent,stroke:transparent
```
<details>
<summary><i>Code entrypoints</i></summary>
@@ -201,6 +433,59 @@ loop QueueProcessor
end
```
```mermaid
---
config:
layout: elk
---
flowchart LR
subgraph left["&nbsp"]
direction TB
subgraph ms[Mutable State]
direction TB
ms1["Workflow Task: Empty"]
end
subgraph transferQ[Transfer Queue]
direction LR
transfer1("&nbsp")
end
subgraph timerQ[Timer Queue]
direction LR
timer1("Workflow Task Timeout") ~~~
timer2("Activity Task Timeout") ~~~
timer3("Workflow Timeout")
end
ms ~~~ transferQ ~~~ timerQ
end
subgraph history[Workflow History]
direction TB
e1[WorkflowExecutionStarted] ~~~
e2[WorkflowTaskScheduled] ~~~
e3[WorkflowTaskStarted] ~~~
e4[WorkflowTaskCompleted] ~~~
e5[ActivityTaskScheduled] ~~~
e6[ActivityTaskStarted] ~~~
e7[ActivityTaskCompleted] ~~~
e8[WorkflowTaskScheduled] ~~~
e9[WorkflowTaskStarted] ~~~
e10[WorkflowTaskCompleted] ~~~
e11[WorkflowExecutionCompleted]
end
left ~~~ history
style left fill:transparent,stroke:transparent
```
<details>
<summary><i>Code entrypoints</i></summary>
@@ -231,6 +516,53 @@ loop QueueProcessor
end
```
```mermaid
---
config:
layout: elk
---
flowchart LR
subgraph left["&nbsp"]
direction TB
subgraph ms[Mutable State]
direction TB
ms1["Workflow Task: Empty"] ~~~
ms2["Activity Task: Scheduled, Attempt 2"]
end
subgraph transferQ[Transfer Queue]
direction LR
transfer1("&nbsp")
end
subgraph timerQ[Timer Queue]
direction LR
timer1("Activity Retry") ~~~
timer2("Workflow Timeout")
end
ms ~~~ transferQ ~~~ timerQ
end
subgraph history[Workflow History]
direction TB
e1[WorkflowExecutionStarted] ~~~
e2[WorkflowTaskScheduled] ~~~
e3[WorkflowTaskStarted] ~~~
e4[WorkflowTaskCompleted] ~~~
e5[ActivityTaskScheduled]
end
left ~~~ history
style left fill:transparent,stroke:transparent
```
<details>
<summary><i>Code entrypoints</i></summary>