forked from temporalio/samples-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
starter.py
32 lines (25 loc) · 785 Bytes
/
starter.py
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
import asyncio
import dataclasses
import temporalio.converter
from temporalio.client import Client
from encryption.codec import EncryptionCodec
from encryption.worker import GreetingWorkflow
async def main():
# Connect client
client = await Client.connect(
"localhost:7233",
# Use the default converter, but change the codec
data_converter=dataclasses.replace(
temporalio.converter.default(), payload_codec=EncryptionCodec()
),
)
# Run workflow
result = await client.execute_workflow(
GreetingWorkflow.run,
"Temporal",
id=f"encryption-workflow-id",
task_queue="encryption-task-queue",
)
print(f"Workflow result: {result}")
if __name__ == "__main__":
asyncio.run(main())