Colton
08/15/2024, 8:49 PMMarvin
08/15/2024, 8:49 PMpython
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:
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?Nate
08/15/2024, 8:50 PMColton
08/15/2024, 8:53 PMColton
08/15/2024, 8:53 PMNate
08/15/2024, 8:54 PMmaybe host a webpage in streamliti'd be curious to see what you end up with! cc @Tony Kipkemboi
Tony Kipkemboi
08/15/2024, 9:12 PMColton
08/15/2024, 9:20 PMTony Kipkemboi
08/15/2024, 9:21 PM