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
29 lines (21 loc) · 753 Bytes
/
starter.py
File metadata and controls
29 lines (21 loc) · 753 Bytes
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
import asyncio
from uuid import uuid4
from temporalio.client import Client
from worker_specific_task_queues.tasks import FileProcessing
async def main():
# Connect client
client = await Client.connect("localhost:7233")
# Start 10 concurrent workflows
futures = []
for idx in range(10):
result = client.execute_workflow(
FileProcessing.run,
id=f"worker_specific_task_queue-workflow-id-{idx}",
task_queue="worker_specific_task_queue-distribution-queue",
)
await asyncio.sleep(0.1)
futures.append(result)
checksums = await asyncio.gather(*futures)
print("\n".join([f"Output checksums:"] + checksums))
if __name__ == "__main__":
asyncio.run(main())