Show outputs on dashboard
This commit is contained in:
parent
ba955c444b
commit
b4492da2e6
3 changed files with 13 additions and 3 deletions
|
|
@ -70,7 +70,6 @@ def create_dash_app(function_name: str, function_docs: str) -> Flask:
|
||||||
get_footer(),
|
get_footer(),
|
||||||
interval := dcc.Interval(
|
interval := dcc.Interval(
|
||||||
interval=4 * 1000, # in milliseconds
|
interval=4 * 1000, # in milliseconds
|
||||||
n_intervals=0,
|
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
@ -116,6 +115,10 @@ def create_dash_app(function_name: str, function_docs: str) -> Flask:
|
||||||
rows = get_context().persistence.query(
|
rows = get_context().persistence.query(
|
||||||
conjunctive_filters=non_null_conjunctive_filters
|
conjunctive_filters=non_null_conjunctive_filters
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not rows:
|
||||||
|
return go.Figure()
|
||||||
|
|
||||||
df = pd.DataFrame(rows)
|
df = pd.DataFrame(rows)
|
||||||
|
|
||||||
fig = px.histogram(
|
fig = px.histogram(
|
||||||
|
|
@ -150,13 +153,16 @@ def create_dash_app(function_name: str, function_docs: str) -> Flask:
|
||||||
conjunctive_filters=non_null_conjunctive_filters
|
conjunctive_filters=non_null_conjunctive_filters
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not rows:
|
||||||
|
return go.Figure()
|
||||||
|
|
||||||
df = pd.DataFrame(rows)
|
df = pd.DataFrame(rows)
|
||||||
return go.Figure(
|
return go.Figure(
|
||||||
go.Parcoords(
|
go.Parcoords(
|
||||||
dimensions=[
|
dimensions=[
|
||||||
get_dimension_descriptor(df, c)
|
get_dimension_descriptor(df, c)
|
||||||
for c in df.columns
|
for c in df.columns
|
||||||
if not c.startswith("arg:") and c not in {"id", "created"}
|
if not c.startswith("arg:") and c not in {"id", "created", "output"}
|
||||||
],
|
],
|
||||||
line_color=accent_color,
|
line_color=accent_color,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,9 @@ class ParallelTinyDbDriver(PersistenceDriver):
|
||||||
take: Optional[int] = None,
|
take: Optional[int] = None,
|
||||||
) -> List[Dict[str, Any]]:
|
) -> List[Dict[str, Any]]:
|
||||||
documents = self.get_documents()
|
documents = self.get_documents()
|
||||||
|
if not documents:
|
||||||
|
return []
|
||||||
|
|
||||||
df = pd.DataFrame(documents)
|
df = pd.DataFrame(documents)
|
||||||
|
|
||||||
for f in conjunctive_filters:
|
for f in conjunctive_filters:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
from json import dumps
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
|
|
@ -29,7 +30,7 @@ class Trace(BaseModel):
|
||||||
"created": self.created,
|
"created": self.created,
|
||||||
"execution_time_ms": self.execution_time_ms,
|
"execution_time_ms": self.execution_time_ms,
|
||||||
"models": ", ".join(f"{m.key}:{m.version}" for m in self.models),
|
"models": ", ".join(f"{m.key}:{m.version}" for m in self.models),
|
||||||
"output": self.output,
|
"output": dumps(self.output),
|
||||||
"evaluation": self.evaluation,
|
"evaluation": self.evaluation,
|
||||||
**self.logged_values,
|
**self.logged_values,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue