Skip to content

2.19.9: Sync or Swim

Compare
Choose a tag to compare
@cicdw cicdw released this 25 Jul 19:12
· 95 commits to 2.x since this release
0e5fa90

This PR continues Prefect's 2.0 lineage as we prepare for a major 3.0 release. This release is particularly special with respect to 3.0 as it adds warnings to APIs or interfaces that will need updating in 3.0.

There are many internal APIs in Prefect that can be run both synchronously and asynchronously depending on the runtime context in which they are called. If you've ever encountered the error AttributeError: 'coroutine' object has no attribute when loading a Block then you know what I'm referring to. In 3.0 we have updated the internal logic for switching between synchronous/asynchronous modes in an attempt to provide clearer guidelines and improved performance.

If you ever encounter such an error, you can now use the special _sync keyword argument to explicitly enforce the mode of execution you'd prefer:

my_block = Block.load("example/block", _sync=True)

my_block = await Block.load("example/block", _sync=False)

When this kwarg is not provided, Prefect makes an educated guess as to whether a coroutine should be returned to await or whether to run the logic synchronously on your behalf.

New Features 🎉

Bug Fixes 🐞

Development & Tidiness 🧹

Full Changelog: 2.19.8...2.19.9