Tony Yun

    Tony Yun

    1 year ago
    Hi, I tried to search but don’t seems find related answer. I want to change the auto-generated container like names “happy-jelly” stuff. But I don’t want to overcomplicate things like to
    create_flow_run
    in code. What’s the simpliest thing to change by giving the flow run a customized run-id? Assume I only need to trigger the flow run using schedules or UI.
    Kevin Kho

    Kevin Kho

    1 year ago
    Hey @Tony Yun, the simplest way would be to use the
    RenameFlowRun
    task inside your flow code. Docs
    Tony Yun

    Tony Yun

    1 year ago
    does it require to add a task for renaming a flow run id?..
    Kevin Kho

    Kevin Kho

    1 year ago
    That’s more automated, but through the UI you can hover over the flow run name and a pencil will appear and you can click it.
    Tony Yun

    Tony Yun

    1 year ago
    the UI change is for one-time only looks like.
    so there is no parameter/configuration to set the flow run id during initialization?
    Kevin Kho

    Kevin Kho

    1 year ago
    create_flow_run
    takes in a
    run_name
    argument if you are using the
    Client
    Tony Yun

    Tony Yun

    1 year ago
    using Client is also one time only triggers I thought?
    for schedules, nobody ever think to rename the run id to make it making some sense?.. I thought this is a very straightforward idea. but all of the scheduled jobs are being named randomly which I tell no clue by looking at UI.
    Kevin Kho

    Kevin Kho

    1 year ago
    Sorry I am confused. If you want it recurring and always changing for scheduled runs, then
    RenameFlowRun
    in the flow would be the easiest approach. It can’t be set as the flow is created, unless a one time thing with
    create_flow_run
    Tony Yun

    Tony Yun

    1 year ago
    thanks! btw, the example in the API doc is very outdated. After correcting the errors, I can’t seem do it right still:
    RenameFlowRun("hello-flow-1", flow_run_name='test-1')
    
    with Flow(
        "hello-flow", 
        schedule
    ) as flow:
        # download_report()
        load_report(upstream_tasks=[download_report])
    also I don’t know what’s the difference between flow-run-id and flow-run-name
    Kevin Kho

    Kevin Kho

    1 year ago
    The id is a uuid and the name is the string.
    RenameFlowRun
    has to be inside the
    Flow
    You don’t need to supply the id. Just do
    RenameFlowRun()(flow_run_name="new_name")
    inside the Flow.
    Tony Yun

    Tony Yun

    1 year ago
    hmm, it seems it’s not a good practice. I’ll give it up using it this way then. Thank you for the help!
    /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/contextlib.py:120: UserWarning: Tasks were created but not added to the flow: {<Task: RenameFlowRun>}. This can occur when `Task` classes, including `Parameters`, are instantiated inside a `with flow:` block but not added to the flow either explicitly or as the input to another task. For more information, see <https://docs.prefect.io/core/advanced_tutorials/task-guide.html#adding-tasks-to-flows>.
    Kevin Kho

    Kevin Kho

    1 year ago
    You need it under the flow block:
    with Flow(
        "hello-flow", 
        schedule
    ) as flow:
        RenameFlowRun()(flow_run_name='test-1')
        load_report(upstream_tasks=[download_report])