Commit 9410b26
authored
feat: Support scheduling Activities within Workflows (cadence-workflow#41)
<!-- Describe what has changed in this PR -->
**What changed?**
- Add preliminary structure for scheduling activities within Workflow.
- Invoking activity functions within a Workflow will schedule them as an
activity.
- DataConverter is no longer async so that it can be used outside of the
main event loop.
- CadenceError -> CadenceRpcError to indicate that it's the base error
for all Rpc errors, not all errors the client may raise.
- State machine restructure
- State machines are split into multiple files and moved to
`workflow.statemachine`
- HistoryEvents are dispatched to state machines based on their class
and a field specified in the decorator. This resolves the ambiguity in
handling events and the custom handling needed for each type.
- DecisionManager stores all state machines in a single ordered
dictionary, and reorders it when state machines are manipulated. This is
required for the decisions to be ordered correctly.
- State machines interact with futures, completing them based on the
history
- Canceling the futures will cancel the activities/timers
<!-- Tell your future self why have you made these changes -->
**Why?**
- Core workflow functionality
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
**How did you test it?**
- Unit tests. We need the deterministic event loop and workflow
execution supported before this can effectively be tested.
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
**Potential risks**
<!-- Is it notable for release? e.g. schema updates, configuration or
data migration required? If so, please mention it, and also update
CHANGELOG.md -->
**Release notes**
<!-- Is there any documentation updates should be made for config,
https://cadenceworkflow.io/docs/operation-guide/setup/ ? If so, please
open an PR in https://github.com/cadence-workflow/cadence-docs -->
**Documentation Changes**1 parent f91c925 commit 9410b26
File tree
37 files changed
+1312
-1492
lines changed- cadence
- _internal
- activity
- rpc
- workflow
- statemachine
- worker
- tests
- cadence
- _internal
- rpc
- workflow
- statemachine
- worker
- integration_tests
37 files changed
+1312
-1492
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
0 commit comments