Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
Signed-off-by: Praneeth Bedapudi <[email protected]>
  • Loading branch information
bedapudi6788 committed Jul 20, 2023
1 parent 82984ea commit 6f9d04e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
37 changes: 23 additions & 14 deletions smartdash/smartdash/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,24 +137,32 @@ def main():
graphs.append(stage_time_line)

if data_by_uid:
# Pie chart showing number of failed, success, and in-process uids
metrics_pie = px.pie(
values=[
sum([1 for uid, data in data_by_uid.items() if data["success"]]),
sum([1 for uid, data in data_by_uid.items() if data["in_process"]]),
sum([1 for uid, data in data_by_uid.items() if data["failed"]]),
sum(
[1 for uid, data in data_by_uid.items() if data["long_running"]]
),
],
names=["Success", "In Process", "Failed", "Long running"],
title="Uids by Status",
)
metrics_df = pd.DataFrame({
"status": ["Success" if data["success"]
else "In Process" if data["in_process"]
else "Failed" if data["failed"]
else "Long running"
for uid, data in data_by_uid.items()],
})

metrics_pie = px.pie(metrics_df,
names='status',
title="Uids by Status",
color='status',
color_discrete_map={
"Success": "green",
"In Process": "yellow",
"Failed": "red",
"Long running": "lightcoral"
})

metrics_pie.update_traces(textposition='inside', textinfo='percent+label')

graphs.append(metrics_pie)

cols = st.columns(2, gap="small")
for i, graph in enumerate(graphs):
cols[i % 2].write(graph)
cols[i % 2].plotly_chart(graph)

with st.expander("Show/hide logs"):
logs_data = []
Expand Down Expand Up @@ -196,6 +204,7 @@ def main():
st.dataframe(logs_df)

except Exception as e:
print(e)
st.warning(
"No Apps uploaded logs yet. Please upload logs using the smartlogger CLI."
)
Expand Down
4 changes: 4 additions & 0 deletions smartdash/smartdash/smartdash_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def on_get(self, req, resp):
"logs": [],
"ml_inputs_outputs": [],
"stage_wise_times": {},
"success": None,
"failed": None,
"in_process": None,
"long_running": False,
}

data_by_id[log["u_id"]]["ml_inputs_outputs"].append(ml_inputs_outputs)
Expand Down

0 comments on commit 6f9d04e

Please sign in to comment.