[Features] Async Activity Completion is missing in Python
Async Activity Completion is missing is Python
You can provide a code snippet in the comments or a link to the line numbers of the samples-repo. Once added, I'll update the app-dev page with the new code snippet.
The link in this issue is now broken. Instead of https://docs.temporal.io/application-development/features?lang=python#async-activity-completion it should be https://docs.temporal.io/application-development/features?lang=python#asynchronous-activity-completion.
https://github.com/temporalio/samples-python/blob/main/hello/hello_async_activity_completion.py is the full sample, but basically inside an activity to mark it as completing async, you would:
# Capture token for later completion
captured_token = activity.info().task_token
activity.raise_complete_async()
(this could also work with user-defined activity IDs)
To get a handle to update the activity outside the activity, given a client you would:
handle = my_client.get_async_activity_handle(task_token=captured_token)
Then, on that handle, you can call heartbeat, complete, fail, and report_cancellation to update the activity.