I am trying to orchestrate some k8s object using temporal.
I want to implement status check on k8s resource, how can I do it ?
A few approaches I thought of were:
Let the activity to check status be short-lived, and continuously calling that health check activity in a loop. Problem with this approach is it will make the workflow execution history very large, the lifecycle of those k8s object can be for many days.
Another approach could be putting loop inside acitivty and calling that health check activity once, it will keep the workflow execution history small but activity will live long. The problem what if workflow is terminated, activity will still be running?
As per the logs, my worker is running in first attempt,
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
Checking status for demo1.
Activity ID: 2 Activity Attempt: 1
But in the UI, I can see it says activity timeout, the last heartbeat was 11 mins ago.
You should never block a thread in an async def call. This will cause every asyncio function in the system to block and cause issues with the entire system. Use asyncio.sleep