Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/workflow/StreamlitUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,10 +989,8 @@ def parameter_section(self, custom_parameter_function) -> None:
f.write(up.read().decode("utf-8"))
streamlit_js_eval(js_expressions="parent.window.location.reload()")

def execution_section(self, start_workflow_function) -> None:
with st.expander("**Summary**"):
st.markdown(self.export_parameters_markdown())

@st.fragment(run_every=5)
def show_log(self, start_workflow_function):
c1, c2 = st.columns(2)
# Select log level, this can be changed at run time or later without re-running the workflow
log_level = c1.selectbox(
Expand All @@ -1004,6 +1002,7 @@ def execution_section(self, start_workflow_function) -> None:
st.rerun()
elif c1.button("Start Workflow", type="primary", use_container_width=True):
start_workflow_function()
time.sleep(3)
st.rerun()
log_path = Path(self.workflow_dir, "logs", log_level.replace(" ", "-") + ".log")
if log_path.exists():
Expand All @@ -1028,6 +1027,13 @@ def execution_section(self, start_workflow_function) -> None:
st.error("**Errors occurred, check log file.**")
st.code(content, language="neon", line_numbers=False)


def execution_section(self, start_workflow_function) -> None:
with st.expander("**Summary**"):
st.markdown(self.export_parameters_markdown())

self.show_log(start_workflow_function)

def results_section(self, custom_results_function) -> None:
custom_results_function()

Expand Down
6 changes: 4 additions & 2 deletions src/workflow/WorkflowManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def start_workflow(self) -> None:
Starts the workflow process and adds its process id to the pid directory.
The workflow itself needs to be a process, otherwise streamlit will wait for everything to finish before updating the UI again.
"""
# Catch double presses of the button while app is in frozen state
if self.executor.pid_dir.exists():
return

# Delete the log file if it already exists
shutil.rmtree(Path(self.workflow_dir, "logs"), ignore_errors=True)
# Start workflow process
Expand All @@ -40,8 +44,6 @@ def start_workflow(self) -> None:
# Add workflow process id to pid dir
self.executor.pid_dir.mkdir()
Path(self.executor.pid_dir, str(workflow_process.pid)).touch()
time.sleep(3)
st.rerun()

def workflow_process(self) -> None:
"""
Expand Down