v

    vinoth paari

    7 months ago
    Hi How to call outside flow from task. I am getting error
    Kevin Kho

    Kevin Kho

    7 months ago
    with Flow(..) as flow:
        create_flow_run(...)
    if you need to use it outside a Flow, just do
    create_flow_run.run(...)
    v

    vinoth paari

    7 months ago
    is it possible to call flow from task?
    And Not working in while loop
    Kevin Kho

    Kevin Kho

    7 months ago
    If you want to use a task in another task, you have to call the .run() method explicitly but it’s not treated as a task. It’s just the Python underneath that is invoked.
    What are you trying to do with the infinite loop? I would not recommend that because you should just spin up an infinite number of flow runs. I would put the infinite loop inside a task inside if you want an indefinitely running Flow.
    But it’s not a pattern Prefect specifically supports
    v

    vinoth paari

    7 months ago
    My requirement is streaming data processing Step : I will configure the One flow which is continuosly listening my API . If my API gives any reponses . It will trigger another flow where i will do some operation .
    Initiate the another flow continuously like parallel process
    Kevin Kho

    Kevin Kho

    7 months ago
    What is your requirement for the latency? Because Prefect can’t really do this at below 1 minute level
    v

    vinoth paari

    7 months ago
    yes . thaty i using while loop for listing . my problem is unable to initiate another flow from task
    Kevin Kho

    Kevin Kho

    7 months ago
    It’s primarily a batch orchestrator. Prefect 2.0 though will support this use case but it is still in technical preview
    You can by calling
    .run()
    @task
    def some_task():
        create_flow_run.run(...)
    but create_flow_run is not a task anymore. Just the Python under the hood
    v

    vinoth paari

    7 months ago
    so i missed .run right?
    Kevin Kho

    Kevin Kho

    7 months ago
    In this example yes but just not it’s not a task anymore.
    It wont get retries and state tracking
    v

    vinoth paari

    7 months ago
    yes it working now