Skip to content

Commit

Permalink
Explorer improve filtering of available runs (#693)
Browse files Browse the repository at this point in the history
Bugfix to only show runs that have existing manifests in them in the
explorer.
  • Loading branch information
PhilippeMoussalli authored Dec 4, 2023
1 parent c76b0fc commit b3ccf67
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions data_explorer/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"selected_pipeline_path",
"run",
"selected_run_path",
"available_runs",
"component",
"selected_component_path",
"partition",
Expand Down
20 changes: 14 additions & 6 deletions data_explorer/app/interfaces/common_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,19 @@ def _select_run():
"""Selects a run from available runs within the chosen pipeline."""
selected_pipeline_path = st.session_state["pipeline_path"]

available_runs = [
os.path.basename(item)
for item in os.listdir(selected_pipeline_path)
if os.path.isdir(os.path.join(selected_pipeline_path, item))
and item != "cache"
]
def has_manifest_file(path):
return any("manifest.json" in files for _, _, files in os.walk(path))

available_runs = []
for run in os.listdir(selected_pipeline_path):
run_path = os.path.join(selected_pipeline_path, run)
if (
os.path.isdir(run_path)
and run != "cache"
and has_manifest_file(run_path)
):
available_runs.append(os.path.basename(run))

available_runs.sort(reverse=True)

default_index = get_default_index("run", available_runs)
Expand All @@ -111,6 +118,7 @@ def _select_run():

st.session_state["run"] = selected_run
st.session_state["run_path"] = selected_run_path
st.session_state["available_runs"] = available_runs

def create_common_interface(self):
"""Sets up the Streamlit app's main interface with common elements."""
Expand Down
7 changes: 2 additions & 5 deletions data_explorer/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,10 @@ def get_pipeline_info_df(self):
"""Get the pipeline info dataframe."""
selected_pipeline_path = st.session_state["pipeline_path"]

available_runs = st.session_state["available_runs"]
available_runs_path = [
os.path.join(selected_pipeline_path, item)
for item in os.listdir(selected_pipeline_path)
if os.path.isdir(os.path.join(selected_pipeline_path, item))
and item != "cache"
os.path.join(selected_pipeline_path, run) for run in available_runs
]
available_runs_path.sort(reverse=True)

data = []
for run_path in available_runs_path:
Expand Down

0 comments on commit b3ccf67

Please sign in to comment.