Spaces:
Runtime error
Runtime error
Password protected the system controls page
Browse files- pages/900_System_Status.py +57 -47
pages/900_System_Status.py
CHANGED
@@ -6,61 +6,71 @@ from src.common import *
|
|
6 |
from src.architectures import Architecture
|
7 |
|
8 |
|
|
|
9 |
if st_setup('LLM Arch'):
|
10 |
st.write("# System Status")
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
6 |
from src.architectures import Architecture
|
7 |
|
8 |
|
9 |
+
|
10 |
if st_setup('LLM Arch'):
|
11 |
st.write("# System Status")
|
12 |
|
13 |
+
if 'admin_logged_in' not in st.session_state:
|
14 |
+
entered_pw = st.text_input(label="Enter the admin password to manage the system", type="password")
|
15 |
+
if st.button('Login'):
|
16 |
+
if entered_pw == st.secrets['admin_pw']:
|
17 |
+
st.session_state['admin_logged_in'] = True
|
18 |
+
st.rerun()
|
19 |
+
else:
|
20 |
+
st.error("Incorrect password")
|
21 |
+
else:
|
22 |
+
st.write("## Wipe Trace Logs")
|
23 |
+
if st.button("Wipe logs"):
|
24 |
+
Architecture.wipe_trace()
|
25 |
+
st.write('Note - wipe will only wipe the temporary file, DB persisted records will be saved')
|
26 |
|
27 |
+
st.divider()
|
28 |
|
29 |
+
st.write("## HF Inference Endpoint Statuses")
|
30 |
+
st.write("The following endpoints need to be running to run all the demonstrations.")
|
31 |
|
32 |
+
endpoints = st.secrets['endpoints'].split(',')
|
33 |
+
refresh = False
|
34 |
|
35 |
+
for i, e in enumerate(endpoints):
|
36 |
+
status = hf_endpoint_status('alfraser', e)
|
37 |
+
message = f'{e} ({status})'
|
38 |
|
39 |
+
if i != 0:
|
40 |
+
st.divider()
|
41 |
|
42 |
+
status_col, button_col = st.columns([2, 1])
|
43 |
|
44 |
+
if status == HF_RUNNING:
|
45 |
+
with status_col:
|
46 |
+
st.success(message)
|
47 |
+
with button_col:
|
48 |
+
if st.button("Pause", key=f'action_{i}'):
|
49 |
+
pause_hf_endpoint('alfraser', e)
|
50 |
+
st.rerun()
|
51 |
+
elif status == HF_SCALEDTOZERO:
|
52 |
+
with status_col:
|
53 |
+
st.error(message)
|
54 |
+
elif status == HF_PAUSED:
|
55 |
+
with status_col:
|
56 |
+
st.warning(message)
|
57 |
+
with button_col:
|
58 |
+
if st.button("Resume", key=f'action_{i}'):
|
59 |
+
resume_hf_endpoint('alfraser', e)
|
60 |
+
st.rerun()
|
61 |
+
elif status == HF_FAILED:
|
62 |
+
with status_col:
|
63 |
+
st.error(message)
|
64 |
+
else:
|
65 |
+
refresh = True
|
66 |
+
with status_col:
|
67 |
+
st.info(message)
|
68 |
+
with button_col:
|
69 |
+
if st.button("Pause", key=f'action_{i}'):
|
70 |
+
pause_hf_endpoint('alfraser', e)
|
71 |
+
st.rerun()
|
72 |
|
73 |
+
if refresh:
|
74 |
+
with st.spinner('Updating every 10 seconds...'):
|
75 |
+
sleep(10)
|
76 |
+
st.rerun()
|