-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move pipeline_state_info into blocks
- Loading branch information
1 parent
20802a0
commit 03c22b7
Showing
2 changed files
with
33 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import dlt | ||
import streamlit as st | ||
|
||
from dlt.common.destination.reference import WithStateSync | ||
from dlt.helpers.streamlit_app.widgets import tag | ||
from dlt.pipeline.state_sync import load_pipeline_state_from_destination | ||
|
||
|
||
def pipeline_state_info(pipeline: dlt.Pipeline) -> None: | ||
st.divider() | ||
tag(pipeline.pipeline_name, label="Pipeline") | ||
tag(pipeline.destination.destination_name, label="Destination") | ||
|
||
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="⚠️", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters