Skip to content

Commit 9bcd479

Browse files
authored
Merge pull request #9 from ICR-RSE-Group/fix_issue_8
use pyalma package instead of ssh.py
2 parents e48b56c + d137280 commit 9bcd479

File tree

8 files changed

+26
-72
lines changed

8 files changed

+26
-72
lines changed

β€Ž.github/workflows/python-package-ci.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
run: |
2525
python -m pip install --upgrade pip
2626
python -m pip install flake8 pytest
27-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
27+
if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
2828
- name: Verify Streamlit app
2929
run: |
3030
timeout 10s streamlit run index.py || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi

β€Ž.gitignoreβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.nf-env

β€Žrequirements.txtβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
pandas==2.2.3
2-
paramiko==3.5.0
2+
paramiko>3.5.0
33
streamlit==1.39.0
44
pre-commit==4.0.1
5+
pyalma @ git+https://github.com/ICR-RSE-Group/pyalma.git@main

β€Žshared/ssh.pyβ€Ž

Lines changed: 0 additions & 41 deletions
This file was deleted.

β€Žtabs/tab_command.pyβ€Ž

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import datetime
21
from contextlib import contextmanager, redirect_stdout
32
from io import StringIO
43

5-
import pandas as pd
64
import streamlit as st
75

86
# Initialize session state variables
97
if "run_pipeline_clicked" not in st.session_state:
108
st.session_state.run_pipeline_clicked = False
9+
if "check_queue" not in st.session_state:
10+
st.session_state.check_queue = False
1111

1212

1313
@contextmanager
@@ -77,22 +77,24 @@ def run_nextflow(): # username, MY_SSH, selected_pipeline, selected_project):
7777
) # develop this
7878
st.write("Command used:")
7979
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)
8181

8282
def check_queue(): # username):
83+
st.session_state.check_queue = True
84+
85+
if st.session_state.check_queue:
8386
cmd_pipeline = pipe_cmd(username, None, None, cmd_num=1)
8487
st.write("Command used:")
8588
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:
8891
st.write("Output:")
89-
st.code(out_str)
92+
st.code(_dict["output"])
9093
st.write(
9194
"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))"
9295
)
93-
9496
else:
95-
st.error(err_str)
97+
st.error(_dict["err"])
9698

9799
left_column, right_column = st.columns(2)
98100
# disable button once the user click a first time. by default it gets disabled after calling the callback

β€Žtabs/tab_logon.pyβ€Ž

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
from io import StringIO
33

44
import streamlit as st
5-
6-
import shared.ssh as ssh
5+
from pyalma import LocalFileReader, SshClient
76

87

98
@contextmanager
@@ -41,21 +40,17 @@ def tab():
4140
OK = True
4241
else:
4342
with st.spinner("Validating login"):
44-
MY_SSH = ssh.SshConnection("remote", username, password, server=server)
45-
43+
MY_SSH = SshClient(server, username, password)
4644
print("Validating login...")
47-
cmd = "cd ~ && ls -l1"
48-
results_str, error_str = MY_SSH.run_cmd(cmd)
49-
50-
if error_str:
51-
print("Errors", error_str)
52-
else:
53-
print("Session validated successfully")
5445

55-
OK = error_str == ""
46+
_dict = MY_SSH.run_cmd("cd ~ &ls -l")
47+
OK = _dict["err"] is None
5648
if OK:
49+
print("Session validated successfully")
5750
st.success("Session validated successfully")
5851
else:
59-
st.error("Correct login details and try again")
52+
print("Errors", _dict["err"])
53+
err_msg = "Connection failed: " + _dict["err"]
54+
st.error(err_msg)
6055

6156
return OK, MY_SSH, username

β€Žviews/login.pyβ€Ž

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
import tabs.tab_logon as tl
66

77
header = """
8-
<span style="color:black;">
9-
<img src="https://www.icr.ac.uk/assets/img/logo.png"
10-
alt="icr" width="200px"></span><span style=
8+
<span style=
119
"color:darkred;font-size:40px;"> -πŸƒ </span><span style=
12-
"color:green;font-size:40px;">RUN-NEXTFLOW</span><span style=
10+
"color:green;font-size:40px;">RUN NEXTFLOW on ALMA</span><span style=
1311
"color:darkred;font-size:40px;">πŸƒ- </span>
1412
"""
1513
st.markdown(header, unsafe_allow_html=True)

β€Žviews/run_pipeline.pyβ€Ž

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ def reset_button_state():
1616

1717

1818
header = """
19-
<span style="color:black;">
20-
<img src="https://www.icr.ac.uk/assets/img/logo.png"
21-
alt="icr" width="200px"></span><span style=
19+
<span style=
2220
"color:darkred;font-size:40px;"> -πŸƒ </span><span style=
23-
"color:green;font-size:40px;">RUN-NEXTFLOW</span><span style=
21+
"color:green;font-size:40px;">RUN NEXTFLOW on ALMA</span><span style=
2422
"color:darkred;font-size:40px;">πŸƒ- </span>
2523
"""
2624
st.markdown(header, unsafe_allow_html=True)

0 commit comments

Comments
Β (0)