Make codebase compatible with Python 3.7
This commit is contained in:
parent
2ad06e8b38
commit
f8db199996
11 changed files with 125 additions and 51 deletions
|
|
@ -15,13 +15,13 @@ from typing import (
|
|||
overload,
|
||||
)
|
||||
|
||||
from async_lru import alru_cache
|
||||
from fastapi import FastAPI
|
||||
from tqdm.cli import tqdm
|
||||
from typing_extensions import Literal # <= Python 3.7
|
||||
|
||||
from ..constants import DASHBOARD_PATH
|
||||
from ..context import get_context
|
||||
from ..external.async_lru import alru_cache
|
||||
from ..helper import freeze_arguments, get_function_metadata_store, snake_case_to_text
|
||||
from ..models.use_model import model_versions
|
||||
from ..parameters.automatically_decorate_parameters import (
|
||||
|
|
|
|||
|
|
@ -34,6 +34,41 @@ def create_dash_app(function_name: str, version: str, function_docs: str) -> Fla
|
|||
],
|
||||
)
|
||||
|
||||
execution_time_histogram_container = html.Div()
|
||||
configuration_container = html.Div(
|
||||
className="configuration-container",
|
||||
)
|
||||
table = get_traces_table()
|
||||
traces_table_container = html.Div(
|
||||
[
|
||||
html.Header(
|
||||
[
|
||||
html.H2("Latest traces"),
|
||||
html.P(
|
||||
"Recent traces and aggregated metrics are presented below. Try filtering the table."
|
||||
),
|
||||
html.A(
|
||||
"Filtering syntax.",
|
||||
href="https://dash.plotly.com/datatable/filtering",
|
||||
target="_blank",
|
||||
),
|
||||
]
|
||||
),
|
||||
table,
|
||||
],
|
||||
className="traces-table-container",
|
||||
)
|
||||
parallel_coordinates = dcc.Graph(
|
||||
className="parallel-coordinates", config={"displaylogo": False}
|
||||
)
|
||||
interval = dcc.Interval(
|
||||
interval=2 * 1000, # in milliseconds
|
||||
n_intervals=0,
|
||||
max_intervals=1
|
||||
if get_context().is_production
|
||||
else -1, # will be incremented in production upon each successful request
|
||||
)
|
||||
|
||||
app.layout = html.Main(
|
||||
[
|
||||
html.Div(
|
||||
|
|
@ -49,43 +84,15 @@ def create_dash_app(function_name: str, version: str, function_docs: str) -> Fla
|
|||
function_docs=function_docs,
|
||||
accent_color=accent_color,
|
||||
),
|
||||
execution_time_histogram_container := html.Div(),
|
||||
execution_time_histogram_container,
|
||||
],
|
||||
),
|
||||
configuration_container := html.Div(
|
||||
className="configuration-container",
|
||||
),
|
||||
traces_table_container := html.Div(
|
||||
[
|
||||
html.Header(
|
||||
[
|
||||
html.H2("Latest traces"),
|
||||
html.P(
|
||||
"Recent traces and aggregated metrics are presented below. Try filtering the table."
|
||||
),
|
||||
html.A(
|
||||
"Filtering syntax.",
|
||||
href="https://dash.plotly.com/datatable/filtering",
|
||||
target="_blank",
|
||||
),
|
||||
]
|
||||
),
|
||||
table := get_traces_table(),
|
||||
],
|
||||
className="traces-table-container",
|
||||
),
|
||||
parallel_coordinates := dcc.Graph(
|
||||
className="parallel-coordinates", config={"displaylogo": False}
|
||||
),
|
||||
configuration_container,
|
||||
traces_table_container,
|
||||
parallel_coordinates,
|
||||
html.Div(className="space-filler"),
|
||||
get_footer(),
|
||||
interval := dcc.Interval(
|
||||
interval=2 * 1000, # in milliseconds
|
||||
n_intervals=0,
|
||||
max_intervals=1
|
||||
if get_context().is_production
|
||||
else -1, # will be incremented in production upon each successful request
|
||||
),
|
||||
interval,
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue