<@ULVA73B9P> is it possible to show in the parent ...
# ask-marvin
a
@Marvin is it possible to show in the parent flow the created artifacts of the subflow
m
Yes, it is possible for a parent flow to have visibility over artifacts created by its subflows (or child flows). Subflows behave like normal flow runs and have a full representation in the backend, as if they had been called separately. Each flow, when called, creates a new task runner for tasks within that particular flow, which is shut down when the flow completes. Here are some details about subflows from the Prefect documentation: - A subflow run is created when a flow function is called inside the execution of another flow. The primary flow is the "parent" flow. The flow created within the parent is the "child" flow or "subflow." - Subflows will block execution of the parent flow until completion unless you make them run asynchronously using tools like AnyIO task groups or
asyncio.gather
. - Any flow written with Prefect can be used as a component in another flow, meaning you can use subflows in much the same way you would use an imported module in a Python script. However, based on the provided excerpts from the documentation, there are no explicit instructions on how to surface artifacts from subflows to the parent flow. You can potentially manage or access subflow artifacts by storing them in a known location and referencing them from the parent flow, assuming proper permissions and path access. For further details and best practices on subflows in Prefect, check the following documentation pages: - Composing flows - Subflows - Workflow Design Patterns with Prefect - Flow of subflows
a
how to configure parent flow to have visibility of artifacts created by subflows
@Marvin how to configure parent flow to have visibility of artifacts created by subflows
m
The search didn't return specific detailed instructions on configuring the visibility of artifacts created by subflows in Prefect. However, based on what is understood about Prefect's orchestration engine and its capabilities, there are a couple of general strategies you can use to pass artifacts from subflows back to the parent flow: 1. Output Return: Have the subflow return any artifacts as part of its output. This can be done by effectively using return statements in the subflow to send data back to the parent flow. 2. Shared Storage: Use shared and accessible storage for both parent and subflows to write and read artifacts. Examples might include cloud storage buckets, databases, or file systems accessible by both flows. 3. Prefect Results: Utilize Prefect's results and state handler features to capture and retrieve artifacts. Results in Prefect represent the output of task runs and can be stored persistently. If these methods do not suffice or seem not to fit your use case, it might be necessary to create a custom solution tailored to your needs, possibly involving the use of task outputs, state handlers, or Prefect's API to interact with the artifacts. You can find more information about Prefect's concepts and how subflows work within the following documentation pages: - Prefect Docs - Composing flows - Prefect Blog - Workflow Design Patterns I would recommend exploring these resources in greater depth for specific implementations or reaching out to Prefect's community for advice on best practices related to your use-case. If there's anything I, or perhaps someone else with a better attitude and more enthusiasm, can do to help, please let me know.