@temporalio/core-bridge 1.12.0 → 1.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +64 -119
- package/Cargo.toml +1 -1
- package/index.js +3 -2
- package/package.json +3 -3
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/sdk-core/.cargo/config.toml +1 -2
- package/sdk-core/.github/workflows/per-pr.yml +2 -0
- package/sdk-core/AGENTS.md +7 -0
- package/sdk-core/Cargo.toml +9 -5
- package/sdk-core/README.md +6 -5
- package/sdk-core/client/Cargo.toml +3 -2
- package/sdk-core/client/src/lib.rs +17 -8
- package/sdk-core/client/src/metrics.rs +57 -23
- package/sdk-core/client/src/raw.rs +33 -15
- package/sdk-core/core/Cargo.toml +11 -9
- package/sdk-core/core/benches/workflow_replay.rs +114 -15
- package/sdk-core/core/src/core_tests/activity_tasks.rs +18 -18
- package/sdk-core/core/src/core_tests/child_workflows.rs +4 -4
- package/sdk-core/core/src/core_tests/determinism.rs +6 -6
- package/sdk-core/core/src/core_tests/local_activities.rs +20 -20
- package/sdk-core/core/src/core_tests/mod.rs +40 -5
- package/sdk-core/core/src/core_tests/queries.rs +25 -16
- package/sdk-core/core/src/core_tests/replay_flag.rs +3 -3
- package/sdk-core/core/src/core_tests/updates.rs +3 -3
- package/sdk-core/core/src/core_tests/workers.rs +9 -7
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +40 -42
- package/sdk-core/core/src/ephemeral_server/mod.rs +1 -19
- package/sdk-core/core/src/lib.rs +10 -1
- package/sdk-core/core/src/pollers/poll_buffer.rs +2 -2
- package/sdk-core/core/src/replay/mod.rs +3 -3
- package/sdk-core/core/src/telemetry/metrics.rs +306 -152
- package/sdk-core/core/src/telemetry/mod.rs +11 -4
- package/sdk-core/core/src/telemetry/otel.rs +134 -131
- package/sdk-core/core/src/telemetry/prometheus_meter.rs +885 -0
- package/sdk-core/core/src/telemetry/prometheus_server.rs +48 -28
- package/sdk-core/core/src/test_help/mod.rs +27 -12
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +7 -7
- package/sdk-core/core/src/worker/activities.rs +4 -4
- package/sdk-core/core/src/worker/client/mocks.rs +10 -3
- package/sdk-core/core/src/worker/client.rs +68 -5
- package/sdk-core/core/src/worker/heartbeat.rs +229 -0
- package/sdk-core/core/src/worker/mod.rs +35 -14
- package/sdk-core/core/src/worker/tuner/resource_based.rs +4 -4
- package/sdk-core/core/src/worker/workflow/history_update.rs +71 -19
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +1 -1
- package/sdk-core/core/src/worker/workflow/machines/nexus_operation_state_machine.rs +31 -48
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +3 -3
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +4 -1
- package/sdk-core/core/src/worker/workflow/managed_run.rs +1 -1
- package/sdk-core/core/src/worker/workflow/mod.rs +15 -15
- package/sdk-core/core-api/Cargo.toml +2 -2
- package/sdk-core/core-api/src/envconfig.rs +204 -99
- package/sdk-core/core-api/src/lib.rs +9 -0
- package/sdk-core/core-api/src/telemetry/metrics.rs +548 -100
- package/sdk-core/core-api/src/worker.rs +11 -5
- package/sdk-core/core-c-bridge/Cargo.toml +49 -0
- package/sdk-core/core-c-bridge/build.rs +26 -0
- package/sdk-core/core-c-bridge/include/temporal-sdk-core-c-bridge.h +817 -0
- package/sdk-core/core-c-bridge/src/client.rs +679 -0
- package/sdk-core/core-c-bridge/src/lib.rs +245 -0
- package/sdk-core/core-c-bridge/src/metric.rs +682 -0
- package/sdk-core/core-c-bridge/src/random.rs +61 -0
- package/sdk-core/core-c-bridge/src/runtime.rs +445 -0
- package/sdk-core/core-c-bridge/src/testing.rs +282 -0
- package/sdk-core/core-c-bridge/src/tests/context.rs +644 -0
- package/sdk-core/core-c-bridge/src/tests/mod.rs +178 -0
- package/sdk-core/core-c-bridge/src/tests/utils.rs +108 -0
- package/sdk-core/core-c-bridge/src/worker.rs +1069 -0
- package/sdk-core/etc/deps.svg +64 -64
- package/sdk-core/sdk/src/activity_context.rs +6 -4
- package/sdk-core/sdk/src/lib.rs +49 -27
- package/sdk-core/sdk/src/workflow_future.rs +18 -25
- package/sdk-core/sdk-core-protos/protos/api_upstream/README.md +4 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.yaml +0 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +630 -83
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +632 -78
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/batch/v1/message.proto +4 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/command/v1/message.proto +6 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/common/v1/message.proto +2 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/deployment/v1/message.proto +32 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/common.proto +10 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/deployment.proto +26 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/reset.proto +4 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/history/v1/message.proto +47 -31
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/nexus/v1/message.proto +4 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/schedule/v1/message.proto +7 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/worker/v1/message.proto +134 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflow/v1/message.proto +14 -11
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +148 -37
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +21 -0
- package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +4 -4
- package/sdk-core/sdk-core-protos/src/history_builder.rs +9 -5
- package/sdk-core/sdk-core-protos/src/lib.rs +96 -6
- package/sdk-core/test-utils/src/lib.rs +11 -3
- package/sdk-core/tests/cloud_tests.rs +3 -3
- package/sdk-core/tests/heavy_tests.rs +11 -3
- package/sdk-core/tests/integ_tests/client_tests.rs +12 -13
- package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/metrics_tests.rs +188 -83
- package/sdk-core/tests/integ_tests/polling_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/queries_tests.rs +56 -40
- package/sdk-core/tests/integ_tests/update_tests.rs +2 -7
- package/sdk-core/tests/integ_tests/worker_tests.rs +3 -4
- package/sdk-core/tests/integ_tests/worker_versioning_tests.rs +3 -7
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +3 -5
- package/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +24 -17
- package/src/client.rs +6 -0
- package/src/metrics.rs +6 -6
package/sdk-core/etc/deps.svg
CHANGED
|
@@ -1,162 +1,162 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
2
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
|
3
3
|
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
4
|
-
<!-- Generated by graphviz version
|
|
4
|
+
<!-- Generated by graphviz version 13.0.1 (0)
|
|
5
5
|
-->
|
|
6
6
|
<!-- Pages: 1 -->
|
|
7
|
-
<svg width="
|
|
8
|
-
viewBox="0.00 0.00
|
|
7
|
+
<svg width="433pt" height="404pt"
|
|
8
|
+
viewBox="0.00 0.00 433.00 404.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
9
9
|
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 400)">
|
|
10
|
-
<polygon fill="white" stroke="none" points="-4,4 -4,-400
|
|
10
|
+
<polygon fill="white" stroke="none" points="-4,4 -4,-400 429.23,-400 429.23,4 -4,4"/>
|
|
11
11
|
<!-- 0 -->
|
|
12
12
|
<g id="node1" class="node">
|
|
13
13
|
<title>0</title>
|
|
14
|
-
<polygon fill="none" stroke="black" points="
|
|
15
|
-
<text text-anchor="middle" x="
|
|
14
|
+
<polygon fill="none" stroke="black" points="239.5,-396 123.75,-396 123.75,-360 239.5,-360 239.5,-396"/>
|
|
15
|
+
<text xml:space="preserve" text-anchor="middle" x="181.62" y="-372.95" font-family="Times,serif" font-size="14.00">temporal-sdk-core</text>
|
|
16
16
|
</g>
|
|
17
17
|
<!-- 1 -->
|
|
18
18
|
<g id="node2" class="node">
|
|
19
19
|
<title>1</title>
|
|
20
|
-
<polygon fill="none" stroke="black" points="
|
|
21
|
-
<text text-anchor="middle" x="
|
|
20
|
+
<polygon fill="none" stroke="black" points="57.25,-324 0,-324 0,-288 57.25,-288 57.25,-324"/>
|
|
21
|
+
<text xml:space="preserve" text-anchor="middle" x="28.62" y="-300.95" font-family="Times,serif" font-size="14.00">rustfsm</text>
|
|
22
22
|
</g>
|
|
23
23
|
<!-- 0->1 -->
|
|
24
24
|
<g id="edge1" class="edge">
|
|
25
25
|
<title>0->1</title>
|
|
26
|
-
<path fill="none" stroke="black" d="
|
|
27
|
-
<polygon fill="black" stroke="black" points="
|
|
26
|
+
<path fill="none" stroke="black" d="M143.41,-359.52C120.38,-348.98 91.12,-335.59 67.91,-324.97"/>
|
|
27
|
+
<polygon fill="black" stroke="black" points="69.64,-321.91 59.09,-320.94 66.72,-328.28 69.64,-321.91"/>
|
|
28
28
|
</g>
|
|
29
29
|
<!-- 3 -->
|
|
30
30
|
<g id="node3" class="node">
|
|
31
31
|
<title>3</title>
|
|
32
|
-
<polygon fill="none" stroke="black" points="
|
|
33
|
-
<text text-anchor="middle" x="
|
|
32
|
+
<polygon fill="none" stroke="black" points="289.25,-180 190,-180 190,-144 289.25,-144 289.25,-180"/>
|
|
33
|
+
<text xml:space="preserve" text-anchor="middle" x="239.62" y="-156.95" font-family="Times,serif" font-size="14.00">temporal-client</text>
|
|
34
34
|
</g>
|
|
35
35
|
<!-- 0->3 -->
|
|
36
36
|
<g id="edge2" class="edge">
|
|
37
37
|
<title>0->3</title>
|
|
38
|
-
<path fill="none" stroke="black" d="
|
|
39
|
-
<polygon fill="black" stroke="black" points="
|
|
38
|
+
<path fill="none" stroke="black" d="M186.27,-359.85C196.24,-323.07 219.76,-236.29 231.97,-191.24"/>
|
|
39
|
+
<polygon fill="black" stroke="black" points="235.32,-192.26 234.56,-181.69 228.56,-190.43 235.32,-192.26"/>
|
|
40
40
|
</g>
|
|
41
41
|
<!-- 4 -->
|
|
42
42
|
<g id="node4" class="node">
|
|
43
43
|
<title>4</title>
|
|
44
|
-
<polygon fill="none" stroke="black" points="
|
|
45
|
-
<text text-anchor="middle" x="
|
|
44
|
+
<polygon fill="none" stroke="black" points="346,-108 209.25,-108 209.25,-72 346,-72 346,-108"/>
|
|
45
|
+
<text xml:space="preserve" text-anchor="middle" x="277.62" y="-84.95" font-family="Times,serif" font-size="14.00">temporal-sdk-core-api</text>
|
|
46
46
|
</g>
|
|
47
47
|
<!-- 0->4 -->
|
|
48
|
-
<g id="
|
|
48
|
+
<g id="edge4" class="edge">
|
|
49
49
|
<title>0->4</title>
|
|
50
|
-
<path fill="none" stroke="black" d="
|
|
51
|
-
<polygon fill="black" stroke="black" points="
|
|
50
|
+
<path fill="none" stroke="black" d="M239.96,-371.52C300.11,-364.52 387.94,-350.08 408.62,-324 463.57,-254.75 364.22,-159.56 309.77,-115.37"/>
|
|
51
|
+
<polygon fill="black" stroke="black" points="312,-112.66 301.99,-109.17 307.63,-118.14 312,-112.66"/>
|
|
52
52
|
</g>
|
|
53
53
|
<!-- 5 -->
|
|
54
54
|
<g id="node5" class="node">
|
|
55
55
|
<title>5</title>
|
|
56
|
-
<polygon fill="none" stroke="black" points="
|
|
57
|
-
<text text-anchor="middle" x="
|
|
56
|
+
<polygon fill="none" stroke="black" points="258.62,-36 104.62,-36 104.62,0 258.62,0 258.62,-36"/>
|
|
57
|
+
<text xml:space="preserve" text-anchor="middle" x="181.62" y="-12.95" font-family="Times,serif" font-size="14.00">temporal-sdk-core-protos</text>
|
|
58
58
|
</g>
|
|
59
59
|
<!-- 0->5 -->
|
|
60
|
-
<g id="
|
|
60
|
+
<g id="edge5" class="edge">
|
|
61
61
|
<title>0->5</title>
|
|
62
|
-
<path fill="none" stroke="black" d="
|
|
63
|
-
<polygon fill="black" stroke="black" points="
|
|
62
|
+
<path fill="none" stroke="black" d="M159.84,-359.83C131.52,-335.39 85.62,-287.67 85.62,-235 85.62,-235 85.62,-235 85.62,-161 85.62,-113.27 123.32,-69.6 151.46,-43.65"/>
|
|
63
|
+
<polygon fill="black" stroke="black" points="153.58,-46.45 158.71,-37.18 148.92,-41.23 153.58,-46.45"/>
|
|
64
64
|
</g>
|
|
65
65
|
<!-- 6 -->
|
|
66
66
|
<g id="node6" class="node">
|
|
67
67
|
<title>6</title>
|
|
68
|
-
<polygon fill="none" stroke="black" points="
|
|
69
|
-
<text text-anchor="middle" x="
|
|
68
|
+
<polygon fill="none" stroke="black" points="202.62,-252 114.62,-252 114.62,-216 202.62,-216 202.62,-252"/>
|
|
69
|
+
<text xml:space="preserve" text-anchor="middle" x="158.62" y="-228.95" font-family="Times,serif" font-size="14.00">temporal-sdk</text>
|
|
70
70
|
</g>
|
|
71
71
|
<!-- 0->6 -->
|
|
72
72
|
<g id="edge3" class="edge">
|
|
73
73
|
<title>0->6</title>
|
|
74
|
-
<path fill="none" stroke="blue" d="
|
|
75
|
-
<polygon fill="blue" stroke="blue" points="
|
|
74
|
+
<path fill="none" stroke="blue" d="M174.19,-359.59C167.81,-335.61 160.46,-292.14 157.7,-263.42"/>
|
|
75
|
+
<polygon fill="blue" stroke="blue" points="161.2,-263.32 156.93,-253.62 154.22,-263.86 161.2,-263.32"/>
|
|
76
76
|
</g>
|
|
77
77
|
<!-- 7 -->
|
|
78
78
|
<g id="node7" class="node">
|
|
79
79
|
<title>7</title>
|
|
80
|
-
<polygon fill="none" stroke="black" points="
|
|
81
|
-
<text text-anchor="middle" x="
|
|
80
|
+
<polygon fill="none" stroke="black" points="400,-324 233.25,-324 233.25,-288 400,-288 400,-324"/>
|
|
81
|
+
<text xml:space="preserve" text-anchor="middle" x="316.62" y="-300.95" font-family="Times,serif" font-size="14.00">temporal-sdk-core-test-utils</text>
|
|
82
82
|
</g>
|
|
83
83
|
<!-- 0->7 -->
|
|
84
84
|
<g id="edge6" class="edge">
|
|
85
85
|
<title>0->7</title>
|
|
86
|
-
<path fill="none" stroke="blue" d="
|
|
87
|
-
<polygon fill="blue" stroke="blue" points="
|
|
86
|
+
<path fill="none" stroke="blue" d="M209.41,-359.52C226.09,-350.39 247.7,-339.11 267.17,-329.35"/>
|
|
87
|
+
<polygon fill="blue" stroke="blue" points="268.67,-332.52 276.07,-324.93 265.56,-326.25 268.67,-332.52"/>
|
|
88
88
|
</g>
|
|
89
89
|
<!-- 3->4 -->
|
|
90
90
|
<g id="edge7" class="edge">
|
|
91
91
|
<title>3->4</title>
|
|
92
|
-
<path fill="none" stroke="black" d="
|
|
93
|
-
<polygon fill="black" stroke="black" points="
|
|
92
|
+
<path fill="none" stroke="black" d="M249.02,-143.7C253.21,-135.98 258.24,-126.71 262.91,-118.11"/>
|
|
93
|
+
<polygon fill="black" stroke="black" points="265.92,-119.89 267.62,-109.43 259.77,-116.55 265.92,-119.89"/>
|
|
94
94
|
</g>
|
|
95
|
-
<!--
|
|
95
|
+
<!-- 3->5 -->
|
|
96
96
|
<g id="edge8" class="edge">
|
|
97
|
-
<title>
|
|
98
|
-
<path fill="none" stroke="black" d="
|
|
99
|
-
<polygon fill="black" stroke="black" points="
|
|
97
|
+
<title>3->5</title>
|
|
98
|
+
<path fill="none" stroke="black" d="M223.84,-143.56C215.76,-133.76 206.43,-120.92 200.62,-108 192.01,-88.82 187.21,-65.53 184.6,-47.59"/>
|
|
99
|
+
<polygon fill="black" stroke="black" points="188.1,-47.37 183.34,-37.9 181.16,-48.27 188.1,-47.37"/>
|
|
100
100
|
</g>
|
|
101
|
-
<!--
|
|
101
|
+
<!-- 4->5 -->
|
|
102
102
|
<g id="edge9" class="edge">
|
|
103
|
-
<title>
|
|
104
|
-
<path fill="none" stroke="black" d="
|
|
105
|
-
<polygon fill="black" stroke="black" points="
|
|
103
|
+
<title>4->5</title>
|
|
104
|
+
<path fill="none" stroke="black" d="M253.89,-71.7C242.01,-63.03 227.43,-52.4 214.49,-42.96"/>
|
|
105
|
+
<polygon fill="black" stroke="black" points="216.78,-40.3 206.64,-37.24 212.66,-45.96 216.78,-40.3"/>
|
|
106
106
|
</g>
|
|
107
107
|
<!-- 6->0 -->
|
|
108
108
|
<g id="edge11" class="edge">
|
|
109
109
|
<title>6->0</title>
|
|
110
|
-
<path fill="none" stroke="black" d="
|
|
111
|
-
<polygon fill="black" stroke="black" points="
|
|
110
|
+
<path fill="none" stroke="black" d="M165.98,-252.11C172.36,-275.92 179.72,-319.37 182.51,-348.22"/>
|
|
111
|
+
<polygon fill="black" stroke="black" points="179.02,-348.39 183.3,-358.08 186,-347.83 179.02,-348.39"/>
|
|
112
112
|
</g>
|
|
113
113
|
<!-- 6->3 -->
|
|
114
114
|
<g id="edge10" class="edge">
|
|
115
115
|
<title>6->3</title>
|
|
116
|
-
<path fill="none" stroke="black" d="
|
|
117
|
-
<polygon fill="black" stroke="black" points="
|
|
116
|
+
<path fill="none" stroke="black" d="M178.65,-215.7C188.38,-207.28 200.26,-197.02 210.94,-187.79"/>
|
|
117
|
+
<polygon fill="black" stroke="black" points="213.13,-190.52 218.41,-181.34 208.55,-185.23 213.13,-190.52"/>
|
|
118
118
|
</g>
|
|
119
119
|
<!-- 6->4 -->
|
|
120
|
-
<g id="
|
|
120
|
+
<g id="edge12" class="edge">
|
|
121
121
|
<title>6->4</title>
|
|
122
|
-
<path fill="none" stroke="black" d="
|
|
123
|
-
<polygon fill="black" stroke="black" points="
|
|
122
|
+
<path fill="none" stroke="black" d="M158.87,-215.84C159.98,-196.51 164.4,-165.05 180.62,-144 190.33,-131.4 203.92,-121.4 217.86,-113.65"/>
|
|
123
|
+
<polygon fill="black" stroke="black" points="219.41,-116.79 226.68,-109.08 216.19,-110.57 219.41,-116.79"/>
|
|
124
124
|
</g>
|
|
125
125
|
<!-- 6->5 -->
|
|
126
|
-
<g id="
|
|
126
|
+
<g id="edge13" class="edge">
|
|
127
127
|
<title>6->5</title>
|
|
128
|
-
<path fill="none" stroke="black" d="
|
|
129
|
-
<polygon fill="black" stroke="black" points="
|
|
128
|
+
<path fill="none" stroke="black" d="M158.28,-215.56C158.09,-197.59 158.28,-168.77 160.62,-144 163.8,-110.53 170.66,-72.48 175.68,-47.24"/>
|
|
129
|
+
<polygon fill="black" stroke="black" points="179.05,-48.27 177.61,-37.77 172.19,-46.87 179.05,-48.27"/>
|
|
130
130
|
</g>
|
|
131
131
|
<!-- 7->0 -->
|
|
132
132
|
<g id="edge16" class="edge">
|
|
133
133
|
<title>7->0</title>
|
|
134
|
-
<path fill="none" stroke="black" d="
|
|
135
|
-
<polygon fill="black" stroke="black" points="
|
|
134
|
+
<path fill="none" stroke="black" d="M289.25,-324.26C272.65,-333.36 251.07,-344.62 231.55,-354.41"/>
|
|
135
|
+
<polygon fill="black" stroke="black" points="230.03,-351.26 222.63,-358.84 233.15,-357.53 230.03,-351.26"/>
|
|
136
136
|
</g>
|
|
137
137
|
<!-- 7->3 -->
|
|
138
138
|
<g id="edge14" class="edge">
|
|
139
139
|
<title>7->3</title>
|
|
140
|
-
<path fill="none" stroke="black" d="
|
|
141
|
-
<polygon fill="black" stroke="black" points="
|
|
140
|
+
<path fill="none" stroke="black" d="M307.18,-287.59C293.95,-263.18 269.77,-218.58 254.21,-189.89"/>
|
|
141
|
+
<polygon fill="black" stroke="black" points="257.47,-188.56 249.62,-181.44 251.32,-191.9 257.47,-188.56"/>
|
|
142
142
|
</g>
|
|
143
143
|
<!-- 7->4 -->
|
|
144
|
-
<g id="
|
|
144
|
+
<g id="edge17" class="edge">
|
|
145
145
|
<title>7->4</title>
|
|
146
|
-
<path fill="none" stroke="black" d="
|
|
147
|
-
<polygon fill="black" stroke="black" points="
|
|
146
|
+
<path fill="none" stroke="black" d="M316.2,-287.82C315.13,-258.08 311.41,-195.31 298.62,-144 296.54,-135.64 293.45,-126.85 290.27,-118.87"/>
|
|
147
|
+
<polygon fill="black" stroke="black" points="293.51,-117.54 286.41,-109.68 287.06,-120.25 293.51,-117.54"/>
|
|
148
148
|
</g>
|
|
149
149
|
<!-- 7->5 -->
|
|
150
|
-
<g id="
|
|
150
|
+
<g id="edge18" class="edge">
|
|
151
151
|
<title>7->5</title>
|
|
152
|
-
<path fill="none" stroke="black" d="
|
|
153
|
-
<polygon fill="black" stroke="black" points="
|
|
152
|
+
<path fill="none" stroke="black" d="M327.2,-287.78C351.21,-246.21 404.1,-138.9 354.62,-72 334.91,-45.34 302.04,-31.66 270.22,-24.78"/>
|
|
153
|
+
<polygon fill="black" stroke="black" points="271,-21.36 260.51,-22.9 269.67,-28.24 271,-21.36"/>
|
|
154
154
|
</g>
|
|
155
155
|
<!-- 7->6 -->
|
|
156
156
|
<g id="edge15" class="edge">
|
|
157
157
|
<title>7->6</title>
|
|
158
|
-
<path fill="none" stroke="black" d="
|
|
159
|
-
<polygon fill="black" stroke="black" points="
|
|
158
|
+
<path fill="none" stroke="black" d="M277.16,-287.52C256.25,-278.25 230.36,-266.78 208.12,-256.93"/>
|
|
159
|
+
<polygon fill="black" stroke="black" points="209.8,-253.85 199.24,-252.99 206.97,-260.25 209.8,-253.85"/>
|
|
160
160
|
</g>
|
|
161
161
|
</g>
|
|
162
162
|
</svg>
|
|
@@ -149,10 +149,12 @@ impl ActContext {
|
|
|
149
149
|
|
|
150
150
|
/// RecordHeartbeat sends heartbeat for the currently executing activity
|
|
151
151
|
pub fn record_heartbeat(&self, details: Vec<Payload>) {
|
|
152
|
-
self.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
if !self.info.is_local {
|
|
153
|
+
self.worker.record_activity_heartbeat(ActivityHeartbeat {
|
|
154
|
+
task_token: self.info.task_token.clone(),
|
|
155
|
+
details,
|
|
156
|
+
})
|
|
157
|
+
}
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
/// Get activity info of the executing activity
|
package/sdk-core/sdk/src/lib.rs
CHANGED
|
@@ -109,6 +109,7 @@ use temporal_sdk_core_protos::{
|
|
|
109
109
|
};
|
|
110
110
|
use tokio::{
|
|
111
111
|
sync::{
|
|
112
|
+
Notify,
|
|
112
113
|
mpsc::{UnboundedSender, unbounded_channel},
|
|
113
114
|
oneshot,
|
|
114
115
|
},
|
|
@@ -151,6 +152,7 @@ struct WorkflowHalf {
|
|
|
151
152
|
workflows: RefCell<HashMap<String, WorkflowData>>,
|
|
152
153
|
/// Maps workflow type to the function for executing workflow runs with that ID
|
|
153
154
|
workflow_fns: RefCell<HashMap<String, WorkflowFunction>>,
|
|
155
|
+
workflow_removed_from_map: Notify,
|
|
154
156
|
}
|
|
155
157
|
struct WorkflowData {
|
|
156
158
|
/// Channel used to send the workflow activations
|
|
@@ -180,6 +182,7 @@ impl Worker {
|
|
|
180
182
|
workflow_half: WorkflowHalf {
|
|
181
183
|
workflows: Default::default(),
|
|
182
184
|
workflow_fns: Default::default(),
|
|
185
|
+
workflow_removed_from_map: Default::default(),
|
|
183
186
|
},
|
|
184
187
|
activity_half: ActivityHalf {
|
|
185
188
|
activity_fns: Default::default(),
|
|
@@ -260,6 +263,7 @@ impl Worker {
|
|
|
260
263
|
join_handle.await??;
|
|
261
264
|
debug!(run_id=%run_id, "Removing workflow from cache");
|
|
262
265
|
wf_half.workflows.borrow_mut().remove(&run_id);
|
|
266
|
+
wf_half.workflow_removed_from_map.notify_one();
|
|
263
267
|
Ok(())
|
|
264
268
|
}
|
|
265
269
|
},
|
|
@@ -293,12 +297,15 @@ impl Worker {
|
|
|
293
297
|
if let Some(ref i) = common.worker_interceptor {
|
|
294
298
|
i.on_workflow_activation(&activation).await?;
|
|
295
299
|
}
|
|
296
|
-
if let Some(wf_fut) = wf_half
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
if let Some(wf_fut) = wf_half
|
|
301
|
+
.workflow_activation_handler(
|
|
302
|
+
common,
|
|
303
|
+
shutdown_token.clone(),
|
|
304
|
+
activation,
|
|
305
|
+
&completions_tx,
|
|
306
|
+
)
|
|
307
|
+
.await?
|
|
308
|
+
&& wf_future_tx.send(wf_fut).is_err()
|
|
302
309
|
{
|
|
303
310
|
panic!("Receive half of completion processor channel cannot be dropped");
|
|
304
311
|
}
|
|
@@ -384,7 +391,7 @@ impl Worker {
|
|
|
384
391
|
|
|
385
392
|
impl WorkflowHalf {
|
|
386
393
|
#[allow(clippy::type_complexity)]
|
|
387
|
-
fn workflow_activation_handler(
|
|
394
|
+
async fn workflow_activation_handler(
|
|
388
395
|
&self,
|
|
389
396
|
common: &CommonWorker,
|
|
390
397
|
shutdown_token: CancellationToken,
|
|
@@ -408,26 +415,29 @@ impl WorkflowHalf {
|
|
|
408
415
|
_ => None,
|
|
409
416
|
}) {
|
|
410
417
|
let workflow_type = &sw.workflow_type;
|
|
411
|
-
let
|
|
412
|
-
|
|
413
|
-
|
|
418
|
+
let (wff, activations) = {
|
|
419
|
+
let wf_fns_borrow = self.workflow_fns.borrow();
|
|
420
|
+
|
|
421
|
+
let Some(wf_function) = wf_fns_borrow.get(workflow_type) else {
|
|
422
|
+
warn!("Workflow type {workflow_type} not found");
|
|
423
|
+
|
|
424
|
+
completions_tx
|
|
425
|
+
.send(WorkflowActivationCompletion::fail(
|
|
426
|
+
run_id,
|
|
427
|
+
format!("Workflow type {workflow_type} not found").into(),
|
|
428
|
+
Some(WorkflowTaskFailedCause::WorkflowWorkerUnhandledFailure),
|
|
429
|
+
))
|
|
430
|
+
.expect("Completion channel intact");
|
|
431
|
+
return Ok(None);
|
|
432
|
+
};
|
|
414
433
|
|
|
415
|
-
|
|
416
|
-
.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
.expect("Completion channel intact");
|
|
422
|
-
return Ok(None);
|
|
434
|
+
wf_function.start_workflow(
|
|
435
|
+
common.worker.get_config().namespace.clone(),
|
|
436
|
+
common.task_queue.clone(),
|
|
437
|
+
std::mem::take(sw),
|
|
438
|
+
completions_tx.clone(),
|
|
439
|
+
)
|
|
423
440
|
};
|
|
424
|
-
|
|
425
|
-
let (wff, activations) = wf_function.start_workflow(
|
|
426
|
-
common.worker.get_config().namespace.clone(),
|
|
427
|
-
common.task_queue.clone(),
|
|
428
|
-
std::mem::take(sw),
|
|
429
|
-
completions_tx.clone(),
|
|
430
|
-
);
|
|
431
441
|
let jh = tokio::spawn(async move {
|
|
432
442
|
tokio::select! {
|
|
433
443
|
r = wff.fuse() => r,
|
|
@@ -442,6 +452,17 @@ impl WorkflowHalf {
|
|
|
442
452
|
join_handle: jh,
|
|
443
453
|
run_id: run_id.clone(),
|
|
444
454
|
});
|
|
455
|
+
loop {
|
|
456
|
+
// It's possible that we've got a new initialize workflow action before the last
|
|
457
|
+
// future for this run finished evicting, as a result of how futures might be
|
|
458
|
+
// interleaved. In that case, just wait until it's not in the map, which should be
|
|
459
|
+
// a matter of only a few `poll` calls.
|
|
460
|
+
if self.workflows.borrow_mut().contains_key(&run_id) {
|
|
461
|
+
self.workflow_removed_from_map.notified().await;
|
|
462
|
+
} else {
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
445
466
|
self.workflows.borrow_mut().insert(
|
|
446
467
|
run_id.clone(),
|
|
447
468
|
WorkflowData {
|
|
@@ -474,7 +495,8 @@ impl WorkflowHalf {
|
|
|
474
495
|
return Ok(None);
|
|
475
496
|
}
|
|
476
497
|
|
|
477
|
-
// In all other cases, we want to
|
|
498
|
+
// In all other cases, we want to error as the runtime could be in an inconsistent state
|
|
499
|
+
// at this point.
|
|
478
500
|
bail!(
|
|
479
501
|
"Got activation {:?} for unknown workflow {}",
|
|
480
502
|
activation,
|
|
@@ -719,7 +741,7 @@ impl Unblockable for NexusStartResult {
|
|
|
719
741
|
unblock_dat: od,
|
|
720
742
|
})
|
|
721
743
|
}
|
|
722
|
-
resolve_nexus_operation_start::Status::
|
|
744
|
+
resolve_nexus_operation_start::Status::Failed(f) => Err(f),
|
|
723
745
|
},
|
|
724
746
|
_ => panic!("Invalid unblock event for nexus operation"),
|
|
725
747
|
}
|
|
@@ -177,7 +177,7 @@ impl WorkflowFuture {
|
|
|
177
177
|
&mut self,
|
|
178
178
|
variant: Option<Variant>,
|
|
179
179
|
outgoing_cmds: &mut Vec<WorkflowCommand>,
|
|
180
|
-
) -> Result<
|
|
180
|
+
) -> Result<(), Error> {
|
|
181
181
|
if let Some(v) = variant {
|
|
182
182
|
match v {
|
|
183
183
|
Variant::InitializeWorkflow(_) => {
|
|
@@ -326,17 +326,14 @@ impl WorkflowFuture {
|
|
|
326
326
|
))?
|
|
327
327
|
}
|
|
328
328
|
Variant::RemoveFromCache(_) => {
|
|
329
|
-
|
|
330
|
-
// How best to do this in executor agnostic way? Is that possible?
|
|
331
|
-
// -- tokio JoinSet does this in a nice way.
|
|
332
|
-
return Ok(true);
|
|
329
|
+
unreachable!("Cache removal should happen higher up");
|
|
333
330
|
}
|
|
334
331
|
}
|
|
335
332
|
} else {
|
|
336
333
|
bail!("Empty activation job variant");
|
|
337
334
|
}
|
|
338
335
|
|
|
339
|
-
Ok(
|
|
336
|
+
Ok(())
|
|
340
337
|
}
|
|
341
338
|
}
|
|
342
339
|
|
|
@@ -370,8 +367,8 @@ impl Future for WorkflowFuture {
|
|
|
370
367
|
.map(Into::into);
|
|
371
368
|
}
|
|
372
369
|
|
|
373
|
-
let mut die_of_eviction_when_done = false;
|
|
374
370
|
let mut activation_cmds = vec![];
|
|
371
|
+
let mut init_activation_cmds = vec![];
|
|
375
372
|
// Lame hack to avoid hitting "unregistered" update handlers in a situation where
|
|
376
373
|
// the history has no commands until an update is accepted. Will go away w/ SDK redesign
|
|
377
374
|
if activation
|
|
@@ -386,24 +383,11 @@ impl Future for WorkflowFuture {
|
|
|
386
383
|
})
|
|
387
384
|
{
|
|
388
385
|
// Poll the workflow future once to get things registered
|
|
389
|
-
if self.poll_wf_future(cx, &run_id, &mut
|
|
386
|
+
if self.poll_wf_future(cx, &run_id, &mut init_activation_cmds)? {
|
|
390
387
|
continue;
|
|
391
388
|
}
|
|
392
389
|
}
|
|
393
390
|
|
|
394
|
-
for WorkflowActivationJob { variant } in activation.jobs {
|
|
395
|
-
match self.handle_job(variant, &mut activation_cmds) {
|
|
396
|
-
Ok(true) => {
|
|
397
|
-
die_of_eviction_when_done = true;
|
|
398
|
-
}
|
|
399
|
-
Err(e) => {
|
|
400
|
-
self.fail_wft(run_id, e);
|
|
401
|
-
continue 'activations;
|
|
402
|
-
}
|
|
403
|
-
_ => (),
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
391
|
if is_only_eviction {
|
|
408
392
|
// No need to do anything with the workflow code in this case
|
|
409
393
|
self.outgoing_completions
|
|
@@ -412,6 +396,13 @@ impl Future for WorkflowFuture {
|
|
|
412
396
|
return Ok(WfExitValue::Evicted).into();
|
|
413
397
|
}
|
|
414
398
|
|
|
399
|
+
for WorkflowActivationJob { variant } in activation.jobs {
|
|
400
|
+
if let Err(e) = self.handle_job(variant, &mut activation_cmds) {
|
|
401
|
+
self.fail_wft(run_id, e);
|
|
402
|
+
continue 'activations;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
415
406
|
// Drive update functions
|
|
416
407
|
self.update_futures = std::mem::take(&mut self.update_futures)
|
|
417
408
|
.into_iter()
|
|
@@ -438,6 +429,12 @@ impl Future for WorkflowFuture {
|
|
|
438
429
|
)
|
|
439
430
|
.collect();
|
|
440
431
|
|
|
432
|
+
// The commands from the initial activation should go _after_ the updates run. This
|
|
433
|
+
// is still a bit of hacky nonsense, as the first poll of the WF future should be able
|
|
434
|
+
// to observe any state changed by the update handlers - but that's impossible to do
|
|
435
|
+
// with current handler registration. In the real SDK, this will be obviated by them
|
|
436
|
+
// being functions on a struct.
|
|
437
|
+
activation_cmds.extend(init_activation_cmds);
|
|
441
438
|
if self.poll_wf_future(cx, &run_id, &mut activation_cmds)? {
|
|
442
439
|
continue;
|
|
443
440
|
}
|
|
@@ -450,10 +447,6 @@ impl Future for WorkflowFuture {
|
|
|
450
447
|
|
|
451
448
|
self.send_completion(run_id, activation_cmds);
|
|
452
449
|
|
|
453
|
-
if die_of_eviction_when_done {
|
|
454
|
-
return Ok(WfExitValue::Evicted).into();
|
|
455
|
-
}
|
|
456
|
-
|
|
457
450
|
// We don't actually return here, since we could be queried after finishing executing,
|
|
458
451
|
// and it allows us to rely on evictions for death and cache management
|
|
459
452
|
}
|
|
@@ -6,6 +6,10 @@ This repository contains both the protobuf descriptors and OpenAPI documentation
|
|
|
6
6
|
|
|
7
7
|
Install as git submodule to the project.
|
|
8
8
|
|
|
9
|
+
## Contribution
|
|
10
|
+
|
|
11
|
+
Make your change to the temporal/proto files, and run `make` to update the openapi definitions.
|
|
12
|
+
|
|
9
13
|
## License
|
|
10
14
|
|
|
11
15
|
MIT License, please see [LICENSE](LICENSE) for details.
|