alfraser commited on
Commit
c6ae5fd
·
1 Parent(s): abcd8a9

Password protected the system controls page

Browse files
Files changed (1) hide show
  1. 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
- st.write("## Wipe Trace Logs")
13
- if st.button("Wipe logs"):
14
- Architecture.wipe_trace()
15
- st.write('Note - wipe will only wipe the temporary file, DB persisted records will be saved')
 
 
 
 
 
 
 
 
 
16
 
17
- st.divider()
18
 
19
- st.write("## HF Inference Endpoint Statuses")
20
- st.write("The following endpoints need to be running to run all the demonstrations.")
21
 
22
- endpoints = st.secrets['endpoints'].split(',')
23
- refresh = False
24
 
25
- for i, e in enumerate(endpoints):
26
- status = hf_endpoint_status('alfraser', e)
27
- message = f'{e} ({status})'
28
 
29
- if i != 0:
30
- st.divider()
31
 
32
- status_col, button_col = st.columns([2, 1])
33
 
34
- if status == HF_RUNNING:
35
- with status_col:
36
- st.success(message)
37
- with button_col:
38
- if st.button("Pause", key=f'action_{i}'):
39
- pause_hf_endpoint('alfraser', e)
40
- st.rerun()
41
- elif status == HF_SCALEDTOZERO:
42
- with status_col:
43
- st.error(message)
44
- elif status == HF_PAUSED:
45
- with status_col:
46
- st.warning(message)
47
- with button_col:
48
- if st.button("Resume", key=f'action_{i}'):
49
- resume_hf_endpoint('alfraser', e)
50
- st.rerun()
51
- elif status == HF_FAILED:
52
- with status_col:
53
- st.error(message)
54
- else:
55
- refresh = True
56
- with status_col:
57
- st.info(message)
58
- with button_col:
59
- if st.button("Pause", key=f'action_{i}'):
60
- pause_hf_endpoint('alfraser', e)
61
- st.rerun()
62
 
63
- if refresh:
64
- with st.spinner('Updating every 10 seconds...'):
65
- sleep(10)
66
- st.rerun()
 
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()