Create Flow

    To use , always open it as a context manager, just like you open a file. This is considered the best practice in Jina:

    Note

    Warning

    Once a Flow is open via with, you can send data requests to it. However, you cannot change its construction via any more until it leaves the with context.

    The context exits when its inner code is finished. A Flow’s context without inner code will immediately exit. To prevent that, use .block() to suspend the current process.

    To terminate a blocked Flow, one can send use or multiprocessing.Event to send the terminate signal. The following example terminates a Flow from another process.

    Visualize a Flow

    In Jupyter Lab/Notebook, the Flow object is rendered automatically without needing to call .