diff --git a/dlt/cli/_dlt.py b/dlt/cli/_dlt.py index c40cc788dc..2332c0286c 100644 --- a/dlt/cli/_dlt.py +++ b/dlt/cli/_dlt.py @@ -444,7 +444,10 @@ def main() -> int: "--list-pipelines", "-l", default=False, action="store_true", help="List local pipelines" ) pipe_cmd.add_argument( - "--hot-reload", default=False, action="store_true", help="Reload streamlit app (for core development)" + "--hot-reload", + default=False, + action="store_true", + help="Reload streamlit app (for core development)", ) pipe_cmd.add_argument("pipeline_name", nargs="?", help="Pipeline name") pipe_cmd.add_argument("--pipelines-dir", help="Pipelines working directory", default=None) diff --git a/dlt/helpers/streamlit_app/blocks/load_info.py b/dlt/helpers/streamlit_app/blocks/load_info.py index bae56cc45c..134b5ad5a4 100644 --- a/dlt/helpers/streamlit_app/blocks/load_info.py +++ b/dlt/helpers/streamlit_app/blocks/load_info.py @@ -35,7 +35,6 @@ def last_load_info(pipeline: dlt.Pipeline) -> None: rel_time = "---" last_load_id = "---" - st.subheader("Last load info", divider="rainbow") stat("Last load time", rel_time, border_left_width=4) stat("Last load id", last_load_id) stat("Total number of loads", loads_no) diff --git a/dlt/helpers/streamlit_app/blocks/menu.py b/dlt/helpers/streamlit_app/blocks/menu.py index 8c2fca0daa..b6d0b5f7aa 100644 --- a/dlt/helpers/streamlit_app/blocks/menu.py +++ b/dlt/helpers/streamlit_app/blocks/menu.py @@ -1,7 +1,6 @@ import dlt import streamlit as st -from dlt.helpers.streamlit_app.blocks.pipeline_state import pipeline_state_info from dlt.helpers.streamlit_app.utils import HERE from dlt.helpers.streamlit_app.widgets import logo, mode_selector from dlt.helpers.streamlit_app.widgets import pipeline_summary @@ -12,5 +11,4 @@ def menu(pipeline: dlt.Pipeline) -> None: logo() st.page_link(f"{HERE}/pages/dashboard.py", label="Explore data", icon="🕹️") st.page_link(f"{HERE}/pages/load_info.py", label="Load info", icon="💾") - pipeline_state_info(pipeline) pipeline_summary(pipeline) diff --git a/dlt/helpers/streamlit_app/blocks/pipeline_state.py b/dlt/helpers/streamlit_app/blocks/pipeline_state.py deleted file mode 100644 index efa9f0dd06..0000000000 --- a/dlt/helpers/streamlit_app/blocks/pipeline_state.py +++ /dev/null @@ -1,26 +0,0 @@ -import dlt -import streamlit as st - -from dlt.common.destination.reference import WithStateSync -from dlt.pipeline.state_sync import load_pipeline_state_from_destination - - -def pipeline_state_info(pipeline: dlt.Pipeline) -> None: - remote_state = None - with pipeline.destination_client() as client: - if isinstance(client, WithStateSync): - remote_state = load_pipeline_state_from_destination(pipeline.pipeline_name, client) - - local_state = pipeline.state - - if remote_state: - remote_state_version = remote_state["_state_version"] - else: - remote_state_version = "---" # type: ignore - - if remote_state_version != local_state["_state_version"]: - st.text("") - st.warning( - "Looks like that local state is not yet synchronized or synchronization is disabled", - icon="⚠️", - ) diff --git a/dlt/helpers/streamlit_app/pages/load_info.py b/dlt/helpers/streamlit_app/pages/load_info.py index 6483626b47..ee13cf2531 100644 --- a/dlt/helpers/streamlit_app/pages/load_info.py +++ b/dlt/helpers/streamlit_app/pages/load_info.py @@ -17,7 +17,7 @@ def write_load_status_page(pipeline: Pipeline) -> None: - """Display pipeline loading information. Will be moved to dlt package once tested""" + """Display pipeline loading information.""" try: loads_df = query_data_live( @@ -108,11 +108,18 @@ def show_state_versions(pipeline: dlt.Pipeline) -> None: border_left_width=4, ) + if remote_state_version != str(local_state["_state_version"]): + st.text("") + st.warning( + "Looks like that local state is not yet synchronized or synchronization is disabled", + icon="⚠️", + ) + def show(pipeline: dlt.Pipeline) -> None: st.subheader("Load info", divider="rainbow") - write_load_status_page(pipeline) last_load_info(pipeline) + write_load_status_page(pipeline) show_state_versions(pipeline) with st.sidebar: