<@ULVA73B9P> Is there a a way i can view all the f...
# ask-marvin
c
@Marvin Is there a a way i can view all the flow runs in my prefect instance in a GANT style chart rather than a scatter plot ? Ideally having X = Time, Y i= deploymentname, and Size = duration of run?
m
It seems there's limited information available in the docs and no relevant GitHub issues. Prefect doesn't natively support GANTT charts for flow runs directly in its UI. However, you can export flow run data and visualize it using a tool that supports GANTT charts, like Plotly in Python or Microsoft Project. You can fetch the flow run data using the Prefect API or Prefect's Python client and then visualize it: 1. Fetch Flow Run Data:
Copy code
python
   from prefect.client import get_client
   import pandas as pd

   async def fetch_flow_run_data():
       async with get_client() as client:
           flow_runs = await client.read_flow_runs()
       return flow_runs

   flow_runs = fetch_flow_run_data()
2. Visualize Using Plotly:
Copy code
python
   import plotly.express as px

   df = pd.DataFrame(flow_runs)  # Convert flow runs to DataFrame
   df['start_time'] = pd.to_datetime(df['start_time'])
   df['end_time'] = pd.to_datetime(df['end_time'])
   df['duration'] = df['end_time'] - df['start_time']

   fig = px.timeline(df, x_start="start_time", x_end="end_time", y="deployment_name", 
                     title='Flow Runs Gantt Chart', 
                     labels={'duration': 'Run Duration'}, 
                     hover_name="flow_name")
   fig.update_yaxes(categoryorder="total ascending")
   fig.show()
Although creating such visualizations is not directly supported within the Prefect UI, exporting and visualizing with external tools offers great flexibility. For more detailed help, see the Prefect API documentation. Is there anything else I can help you with?
n
not natively in the UI, that might be a good enhancement request i know there's some thought around alternatives to the scatter alternatively, yeah matplotlib / plotly might be quick if you want to just hack something together
👍 1
c
Going play around with that, maybe host a webpage in streamlit and see what that looks like. I really like the the GANTT like flow charts within the FlowRuns themselves
The temporal dependency chart specifically
n
maybe host a webpage in streamlit
i'd be curious to see what you end up with! cc @Tony Kipkemboi
👍 2
t
@Colton, let me know if you need any help with the Streamlit portion. I recently left Streamlit to join Prefect.
catjam 1
c
@Tony Kipkemboi Thanks Tony! I thought I recognized you from somewhere... didn't you host the Streamlit quarterly showcase recently? Congrats on the move!
🎈 1
t
Chanin hosted the most recent one a few weeks ago but I ran the previous ones plus the Streamlit Live Show interviews 2/month
🙌 1