forked from temporalio/samples-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_worker.py
More file actions
26 lines (19 loc) · 684 Bytes
/
run_worker.py
File metadata and controls
26 lines (19 loc) · 684 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
import asyncio
from temporalio.client import Client
from temporalio.envconfig import ClientConfig
from temporalio.worker import Worker
from polling.infrequent.activities import compose_greeting
from polling.infrequent.workflows import GreetingWorkflow
async def main():
config = ClientConfig.load_client_connect_config()
config.setdefault("target_host", "localhost:7233")
client = await Client.connect(**config)
worker = Worker(
client,
task_queue="infrequent-activity-retry-task-queue",
workflows=[GreetingWorkflow],
activities=[compose_greeting],
)
await worker.run()
if __name__ == "__main__":
asyncio.run(main())