dispatchrun / dispatch-py

Python package to develop applications with Dispatch.
https://pypi.org/project/dispatch-py/
Apache License 2.0
56 stars 3 forks source link

Use native coroutines #45

Closed chriso closed 9 months ago

chriso commented 9 months ago

This PR updates the experimental @dispatch.coroutine registration method. It now accepts (and requires) async functions. Two types of awaitables are supported, poll and exit, which match the underlying directives accepted by the orchestrator.

At this time, users must manually decorate any nested async functions they wish to call / await on in order to make them serializable. If an async function hasn't been decorated with @dispatch.coroutine or @dispatch.experimental.durable then a pickle error will occur if/when a coroutine yields.