|
1 | | -import datetime |
2 | 1 | from contextlib import contextmanager, redirect_stdout |
3 | 2 | from io import StringIO |
4 | 3 |
|
5 | | -import pandas as pd |
6 | 4 | import streamlit as st |
7 | 5 |
|
8 | 6 | # Initialize session state variables |
9 | 7 | if "run_pipeline_clicked" not in st.session_state: |
10 | 8 | st.session_state.run_pipeline_clicked = False |
| 9 | +if "check_queue" not in st.session_state: |
| 10 | + st.session_state.check_queue = False |
11 | 11 |
|
12 | 12 |
|
13 | 13 | @contextmanager |
@@ -77,22 +77,24 @@ def run_nextflow(): # username, MY_SSH, selected_pipeline, selected_project): |
77 | 77 | ) # develop this |
78 | 78 | st.write("Command used:") |
79 | 79 | st.code(cmd_pipeline) |
80 | | - out_str, err_str = MY_SSH.run_cmd(cmd_pipeline, string=True) |
| 80 | + _dict = MY_SSH.run_cmd(cmd_pipeline) |
81 | 81 |
|
82 | 82 | def check_queue(): # username): |
| 83 | + st.session_state.check_queue = True |
| 84 | + |
| 85 | + if st.session_state.check_queue: |
83 | 86 | cmd_pipeline = pipe_cmd(username, None, None, cmd_num=1) |
84 | 87 | st.write("Command used:") |
85 | 88 | st.code(cmd_pipeline) |
86 | | - out_str, err_str = MY_SSH.run_cmd(cmd_pipeline, string=True) |
87 | | - if err_str == "": |
| 89 | + _dict = MY_SSH.run_cmd(cmd_pipeline) |
| 90 | + if _dict["err"] == None: |
88 | 91 | st.write("Output:") |
89 | | - st.code(out_str) |
| 92 | + st.code(_dict["output"]) |
90 | 93 | st.write( |
91 | 94 | "If you see '***' job on compute node, that suggests that the job has been sent to the cluster (in the queue (PD) or running (R))" |
92 | 95 | ) |
93 | | - |
94 | 96 | else: |
95 | | - st.error(err_str) |
| 97 | + st.error(_dict["err"]) |
96 | 98 |
|
97 | 99 | left_column, right_column = st.columns(2) |
98 | 100 | # disable button once the user click a first time. by default it gets disabled after calling the callback |
|
0 commit comments