Thread
#prefect-community
    j

    Jason

    4 months ago
    I wanted to double check that it's not possible to modify a task name during the task run, right? I have the following tasks, which take an identical DataPayload TypedDict, but am separating them out to allow for human-friendly task names about the load operation:
    with case(save_snowflake, True):  # type: ignore
            load_snowflake(
                task_args=dict(name="Load Owners into Snowflake"),
                data_payload=owners_df,
            )
            load_snowflake(
                task_args=dict(name="Load Properties into Snowflake"),
                data_payload=properties_df,
            )
            load_snowflake(
                task_args=dict(name="Load Amenities into Snowflake"),
                data_payload=amenities_df,
            )
    
            load_snowflake.map(
                data_payload=tuple(reservations_df),
                task_args=dict(name="Load Reservations into Snowflake"),
            )
    Otherwise, the preference would be to consolidate the identical structs into one load_snowflake map operation.
    Actually,
    task_run_name
    seems relevant. Does anyone have an example of its use? https://docs.prefect.io/api/latest/core/task.html#task-2
    Nevermind, answered my own question with with the great docs. For anyone that wants to dynamically name a task during runtime: https://docs.prefect.io/core/idioms/task-run-names.html
    Kevin Kho

    Kevin Kho

    4 months ago
    Yeah you can use
    task_run_name