pypi prefect 2.14.19

latest releases: 2.20.8, 3.0.2, 2.20.7...
7 months ago

Dynamic descriptions for paused and suspended flow runs

You can now include dynamic, markdown-formatted descriptions when pausing or suspending a flow run for human input. This description will be shown in the Prefect UI alongside the form when a user is resuming the flow run, enabling developers to give context and instructions to users when they need to provide input.

from datetime import datetime
from prefect import flow, pause_flow_run, get_run_logger
from prefect.input import RunInput

class UserInput(RunInput):
    name: str
    age: int

@flow
async def greet_user():
    logger = get_run_logger()
    current_date = datetime.now().strftime("%B %d, %Y")

    description_md = f"""
**Welcome to the User Greeting Flow!**
Today's Date: {current_date}

Please enter your details below:
- **Name**: What should we call you?
- **Age**: Just a number, nothing more.
"""

    user_input = await pause_flow_run(
        wait_for_input=UserInput.with_initial_data(
            description=description_md, name="anonymous"
        )
    )

    if user_input.name == "anonymous":
        logger.info("Hello, stranger!")
    else:
        logger.info(f"Hello, {user_input.name}!")

See the following PR for implementation details:

Enhancements

  • Enhanced RunInput saving to include descriptions, improving clarity and documentation for flow inputs — #11776
  • Improved type hinting for automatic run inputs, enhancing the developer experience and code readability — #11796
  • Extended Azure filesystem support with the addition of azure_storage_container for more flexible storage options — #11784
  • Added deployment details to work pool information, offering a more comprehensive view of work pool usage — #11766

Fixes

  • Updated terminal based deployment operations to make links within panels interactive, enhancing user navigation and experience — #11774

Documentation

  • Revised Key-Value (KV) integration documentation for improved clarity and updated authorship details — #11770
  • Further refinements to interactive flows documentation, addressing feedback and clarifying usage — #11772
  • Standardized terminal output in documentation for consistency and readability — #11775
  • Corrected a broken link to agents in the work pool concepts documentation, improving resource accessibility — #11782
  • Updated examples for accuracy and to reflect current best practices — #11786
  • Added guidance on providing descriptions when pausing flow runs, enhancing operational documentation — #11799

Experimental

  • Implemented TaskRunFilterFlowRunId for both client and server, enhancing task run filtering capabilities — #11748
  • Introduced a subscription API for autonomous task scheduling, paving the way for more dynamic and flexible task execution — #11779
  • Conducted testing to ensure server-side scheduling of autonomous tasks, verifying system reliability and performance — #11793
  • Implemented a global collections metadata cache clearance between tests, improving test reliability and accuracy — #11794
  • Initiated task server testing, laying the groundwork for comprehensive server-side task management — #11797

New Contributors

Don't miss a new prefect release

NewReleases is sending notifications on new releases.