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
30 lines (22 loc) · 817 Bytes
/
starter.py
File metadata and controls
30 lines (22 loc) · 817 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
30
import asyncio
from temporalio.client import Client
from temporalio.envconfig import ClientConfig
from sentry.workflow import SentryExampleWorkflow, SentryExampleWorkflowInput
async def main():
config = ClientConfig.load_client_connect_config()
config.setdefault("target_host", "localhost:7233")
# Connect client
client = await Client.connect(**config)
# Run workflow
try:
result = await client.execute_workflow(
SentryExampleWorkflow.run,
SentryExampleWorkflowInput(option="broken"),
id="sentry-workflow-id",
task_queue="sentry-task-queue",
)
print(f"Workflow result: {result}")
except Exception:
print("Workflow failed - check Sentry for details")
if __name__ == "__main__":
asyncio.run(main())