-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkflow.py
More file actions
30 lines (20 loc) · 798 Bytes
/
workflow.py
File metadata and controls
30 lines (20 loc) · 798 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
import time
from datetime import timedelta
from temporalio import workflow
with workflow.unsafe.imports_passed_through():
from activity import compose_greeting
from test_types import ComposeGreetingInput, ComposeGreetingRequest
# Basic workflow that logs and invokes an activity
@workflow.defn
class GreetingWorkflow:
@workflow.run
async def run(self, request: ComposeGreetingRequest) -> str:
workflow.logger.info(f"Running workflow with parameter {request.name}")
for i in range(10):
await workflow.execute_activity(
compose_greeting,
ComposeGreetingInput(greeting="Hello", name=request.name),
start_to_close_timeout=timedelta(seconds=20),
)
return "seconds_"