Skip to content

Commit a8c1ccf

Browse files
author
Michal Tichák
committed
[docs] add summary of virtual states into the operation_order.md
1 parent fd5d7a5 commit a8c1ccf

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ There are two ways of interacting with AliECS:
120120
* [State machine triggers](/docs/handbook/operation_order.md#state-machine-triggers)
121121
* [START_ACTIVITY (Start Of Run)](/docs/handbook/operation_order.md#start_activity-start-of-run)
122122
* [STOP_ACTIVITY (End Of Run)](/docs/handbook/operation_order.md#stop_activity-end-of-run)
123+
* [Virtual states and transitions](/docs/handbook/operation_order.md#virtual-states-and-transitions)
123124
* [Protocol documentation](/docs/apidocs_aliecs.md)
124125
* coconut
125126
* [The O² control and configuration utility overview](/coconut/README.md#the-o-control-and-configuration-utility-overview)

docs/handbook/operation_order.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,21 @@ This is the order of actions happening at a healthy end of run.
102102
- `after_STOP_ACTIVITY` hooks with positive weights (incl. 0) are executed:
103103
- `ccdb.RunStop()` at `0`
104104
- `bookkeeping.UpdateRunStop()`, `bookkeeping.UpdateEnv()` at `+100`
105+
106+
## Virtual states and transitions
107+
108+
State **PENDING** and transitions **TEARDOWN**, and **DESTROY** lie outside the core FSM in `environment.go` and are driven by the Manager. See [core/environment/manager.go](../../core/environment/manager.go) for details.
109+
As these are not in a FSM we trigger them be calling specific methods. You can find details about triggering these in the according sections.
110+
111+
### State PENDING
112+
113+
Before the FSM enters `STANDBY`, the Manager drives the initial creation steps by emitting `Ev_EnvironmentEvent` messages (`Transition: CREATE, State: PENDING`) for both `before_CREATE` (running hooks) and `CREATE` (loading workflow).
114+
115+
### Transition TEARDOWN
116+
117+
When the FSM is in `RUNNING` and `TeardownEnvironment` function is called, the Manager records both `run_end_time_ms` and `run_end_completion_time_ms` and emits message `Ev_RunEvent` with content (`Transition: TEARDOWN`, `OpStatus_STARTED`) for each of timestamps. Right now there is only `OpStatus_STARTED` reported in Kafka. You can trigger `TeardownEnvironment` for example by invoking gRPC method `DestroyEnvironment` with `Force = true`. You cannot trigger `TEARDOWN` by calling gRPC method `Teardown`.
118+
119+
### Transition DESTROY
120+
121+
The Manager’s `TeardownEnvironment(...)` drives a four‑step `Ev_EnvironmentEvent` sequence (`before_DESTROY`, `leave_<state>`, `DESTROY`, `after_DESTROY`) on `topic.Environment` to release tasks, run hooks, and finalize teardown.
122+
You can trigger `TeardownEnvironment` for example by invoking gRPC method `DestroyEnvironment` with `Force = true`.

0 commit comments

Comments
 (0)