Python SDK, workflow terminated but activity still running

Hi,

Im testing out new python sdk for temporal worker, and facing this issue:

  • workflow terminated but activity still running…

is this a bug? or should i handle activity termination as well?

thank you!

error message:

2023-03-15T06:41:31.106647719Z 2023-03-15T06:41:31.106348Z  
WARN temporal_sdk_core::worker::activities: 
Activity not found on completion. 
This may happen if the activity has already been cancelled but completed anyway

Temporal doesn’t terminate running activities automatically, the only way for an activity to get notified of cancellation e.g when explicitly cancelled by the workflow or when the workflow has completely is by heartbeating.
For long running activities, we recommend setting a heartbeat timeout so Temporal can detect when your worker goes away sooner and schedule the next attempt.

@Manticore_ID I know it has been a bit- but I saw similar behavior during some initial workflow creation. Turns out that it was the result of having a blocking sleep in my activity. Switching to asyncio.sleep and awaiting that call resolved the error messages.