Skip to content

Commit

Permalink
Cleanup redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
sultaniman committed Mar 18, 2024
1 parent 5e96f79 commit b09512a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions dlt/helpers/streamlit_app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,16 @@
cache_data = st.experimental_memo


def attach_to_pipeline(pipeline_name: str) -> dlt.Pipeline:
st.session_state["pipeline_name"] = pipeline_name
pipelines_dir = os.getenv("DLT_PIPELINES_DIR")
pipeline = dlt.attach(pipeline_name, pipelines_dir=pipelines_dir)
return pipeline


def render_with_pipeline(render_func: Callable[..., None]) -> None:
if test_pipeline_name := os.getenv("DLT_TEST_PIPELINE_NAME"):
fmt.echo(f"RUNNING TEST PIPELINE: {test_pipeline_name}")
pipeline_name = test_pipeline_name
else:
pipeline_name = sys.argv[1]

pipeline = attach_to_pipeline(pipeline_name)
st.session_state["pipeline_name"] = pipeline_name
pipelines_dir = os.getenv("DLT_PIPELINES_DIR")
pipeline = dlt.attach(pipeline_name, pipelines_dir=pipelines_dir)
render_func(pipeline)


Expand Down

0 comments on commit b09512a

Please sign in to comment.