forked from temporalio/samples-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstarter.py
More file actions
42 lines (33 loc) · 1.16 KB
/
starter.py
File metadata and controls
42 lines (33 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import asyncio
from temporalio.client import Client
from replay.worker import JustActivity, JustTimer, TimerThenActivity
async def main():
# Connect client
client = await Client.connect("localhost:7233")
# Run a few workflows
# Importantly, normally we would *not* advise re-using the same workflow ID for all of these,
# but we do this to avoid requiring advanced visibility when we want to fetch all the histories
# in the replayer.
result = await client.execute_workflow(
JustActivity.run,
"replayer",
id=f"replayer-workflow-id",
task_queue="replay-sample",
)
print(f"JustActivity Workflow result: {result}")
result = await client.execute_workflow(
JustTimer.run,
"replayer",
id=f"replayer-workflow-id",
task_queue="replay-sample",
)
print(f"JustTimer Workflow result: {result}")
result = await client.execute_workflow(
TimerThenActivity.run,
"replayer",
id=f"replayer-workflow-id",
task_queue="replay-sample",
)
print(f"TimerThenActivity Workflow result: {result}")
if __name__ == "__main__":
asyncio.run(main())