v

    Vincent Chéry

    8 months ago
    Hi all 👋 I'm a little confused regarding using regular functions (not tasks) in flows and cannot find information about this in the docs. Maybe I did not look in the write place ? For instance, in
    with Flow("my-flow") as f:
        a = make_a()
        b = make_b()
        c  = a + b
    • Do
    make_a
    and
    make_b
    need to be tasks or can they be regular functions ? • In particular, when using builtin functions (for instance,
    datetime.utcnow()
    ), can we use it directly or must we wrap it in a task ? • Is
    c = a + b
    allowed ? Thanks a lot !
    Anna Geller

    Anna Geller

    8 months ago
    1. make_a and make_b must be tasks in the current Prefect. In Orion, you will be able to call any Python code in your flow, but this is not the case in Prefect <= 1.0 2. You should wrap it in a task 3. Yes, you can see this best when you do
    flow.visualize()
    - this will give you a DAG visualization
    v

    Vincent Chéry

    8 months ago
    Thanks Anna!