We're excited to announce the release candidate of Prefect 3.0. It's the most flexible, powerful, fastest version of Prefect yet. Prefect 3.0 includes several exciting new features. Install it by running pip install prefect==3.0.0rc2
and check out the docs here.
Run tasks independently of flows
You can now run and serve tasks outside of flows and inside of other tasks.
from prefect import task
@task
def my_background_task(name: str):
print(f"Hello, {name}!")
if __name__ == "__main__":
my_background_task.delay("ford")
Transactional semantics
Use rollback and commit hooks to facilitate idempotent python code.
from prefect import flow, task
from prefect.transactions import transaction
@task
def first_task():
print('first')
@first_task.on_rollback
def roll(txn):
print('rolling back')
@task
def second_task():
raise RuntimeError("oopsie")
@flow
def txn_flow():
with transaction():
first_task()
second_task()
if __name__ == "__main__":
txn_flow()
Open source Events and Automations
Trigger actions, such as sending notifications, pausing schedules, starting flow runs and more in response to Prefect events.
More flexible variables and new artifact types
Variables can now be any JSON compatible type including dicts, lists, and integers. Progress and Image artifacts make it easy to add visual annotations to your flow run graph.
Faster and richer CLI
Improved CLI speed and several added commands and conveniences.
Updated navigation, styling, and interaction design
The new Runs page displays both flow and task run information, and an improved sidebar and switcher makes navigating Prefect simpler than ever.
Changes since 3.0.0rc1
Enhancements
- Adds
deferred
kwarg toTask.map
to executed mapped tasks on a task server by @desertaxle in #13756 - Add pydantic version to cli
version
command by @pleek91 in #13715 - conditionally log retryable errors by @jakekaplan in #13773
- Update
Variable.set
return value + docs by @jakekaplan in #13557 - Add new flow runs pagination endpoint by @pleek91 in #13808
- Updates
PrefectDistributedFuture
to use an event websocket to determine task completion by @desertaxle in #13763 - Enhancement: Artifacts documentation by @dylanbhughes in #13724
- Migrate
prefect-kubernetes
to pydantic 2 by @zzstoatzz in #13687 - Add endpoint for bulk task run counts for flow runs by @pleek91 in #13759
- Copy pared down
prefect-redis
to integrations by @bunchesofdonald in #13758 - Cache key policies by @cicdw in #13791
- Refactor task run engine by @jlowin in #13793
- Cache Policy Upgrades by @cicdw in #13821
- Put
AwsCredentials
first to match default factory by @bunchesofdonald in #13819
Fixes
- Fix
load_flow_argument_from_entrypoint
to work with async flows by @elisalimli in #13716 - Add handling for positional only and keyword only arguments when parsing a function signature from source code by @desertaxle in #13774
- Load assignments when safeloading a namespace by @desertaxle in #13775
- Coerce work pool env values to
str
by @zzstoatzz in #13782 - Support
retry_delay_seconds
in task engine by @zzstoatzz in #13815 - Rename
RedisFilesystem
toRedisStorageContainer
to match naming semantics of other filesystem classes by @bunchesofdonald in #13771
Documentation
- Fixes over 500 broken links in docs by @discdiver in #13734
- Remove
agents
concept page and refs for 3.0 by @serinamarie in #13631 - WIP 3.0rc docs new IA (on Mintlify) by @LarryUllman in #13783
- Fixes a doc build from an admonition change and note managed execution not in beta. by @discdiver in #13789
- Update version instruction install docs page by @discdiver in #13795
- Move integration package docs out of versioning by @discdiver in #13760
- Update button text at top of page by @discdiver in #13797
- Update get-started/install page by @LarryUllman in #13822
- Porting over task guide, mdx bugfixes by @WillRaphaelson in #13754
New Contributors
- @elisalimli made their first contribution in #13716
- @LarryUllman made their first contribution in #13783
Full Changelog: 3.0.0rc1...3.0.0rc2