-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathServices.py
More file actions
65 lines (62 loc) · 2.36 KB
/
Services.py
File metadata and controls
65 lines (62 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
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
import streamlit as st
from PBRun import PBRun
from PBRemote import PBRemote
from PBMon import PBMon
from PBData import PBData
from PBCoinData import CoinData
from PBApiServer import PBApiServer
class Services():
def __init__(self):
if "pbrun" not in st.session_state:
st.session_state.pbrun = PBRun()
if "pbremote" not in st.session_state:
st.session_state.pbremote = PBRemote()
if "pbmon" not in st.session_state:
st.session_state.pbmon = PBMon()
if "pbdata" not in st.session_state:
st.session_state.pbdata = PBData()
if "pbcoindata" not in st.session_state:
st.session_state.pbcoindata = CoinData()
if "api_server" not in st.session_state:
st.session_state.api_server = PBApiServer()
self.pbrun = st.session_state.pbrun
self.pbremote = st.session_state.pbremote
self.pbmon = st.session_state.pbmon
self.pbdata = st.session_state.pbdata
self.pbcoindata = st.session_state.pbcoindata
self.api_server = st.session_state.api_server
def stop_all_started(self):
self.pbrun_was_running = False
self.pbremote_was_running = False
self.pbmon_was_running = False
self.pbdata_was_running = False
self.pbcoindata_was_running = False
if self.pbrun.is_running():
self.pbrun_was_running = True
self.pbrun.stop()
if self.pbremote.is_running():
self.pbremote_was_running = True
self.pbremote.stop()
if self.pbmon.is_running():
self.pbmon_was_running = True
self.pbmon.stop()
if self.pbdata.is_running():
self.pbdata_was_running = True
self.pbdata.stop()
if self.pbcoindata.is_running():
self.pbcoindata_was_running = True
self.pbcoindata.stop()
if self.api_server.is_running():
self.api_server_was_running = True
self.api_server.stop()
def start_all_was_running(self):
if self.pbrun_was_running:
self.pbrun.run()
if self.pbremote_was_running:
self.pbremote.run()
if self.pbmon_was_running:
self.pbmon.run()
if self.pbdata_was_running:
self.pbdata.run()
if self.pbcoindata_was_running:
self.pbcoindata.run()