CalebCometML commited on
Commit
e97324d
·
1 Parent(s): 66aa57e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -5,6 +5,7 @@ from pathlib import Path
5
  import streamlit.web.bootstrap
6
  from streamlit import config as _config
7
  import kangas as kg
 
8
 
9
  proj_dir = Path(__file__).parent
10
  filename = proj_dir / "app.py"
@@ -20,6 +21,12 @@ application = Flask(__name__)
20
  @application.route('/kangas', strict_slashes=False)
21
  @application.route('/kangas/<path:path>')
22
  def kangas_proxy(path=None):
 
 
 
 
 
 
23
  query_string = request.query_string.decode('utf-8')
24
 
25
  if path is None and len(query_string) < 1:
@@ -70,4 +77,10 @@ def home():
70
 
71
  if __name__ == "__main__":
72
  kg.launch(ip_address, 7640)
 
 
 
 
 
 
73
  application.run(debug=True)
 
5
  import streamlit.web.bootstrap
6
  from streamlit import config as _config
7
  import kangas as kg
8
+ import subprocess
9
 
10
  proj_dir = Path(__file__).parent
11
  filename = proj_dir / "app.py"
 
21
  @application.route('/kangas', strict_slashes=False)
22
  @application.route('/kangas/<path:path>')
23
  def kangas_proxy(path=None):
24
+ stat = subprocess.call(["systemctl", "is-active", "--quiet", "kangas"])
25
+ if stat == 0:
26
+ application.logger.info("Kangas is running on fetch")
27
+ else:
28
+ application.logger.info("Kangas is not running on fetch")
29
+
30
  query_string = request.query_string.decode('utf-8')
31
 
32
  if path is None and len(query_string) < 1:
 
77
 
78
  if __name__ == "__main__":
79
  kg.launch(ip_address, 7640)
80
+ stat = subprocess.call(["systemctl", "is-active", "--quiet", "kangas"])
81
+ if stat == 0:
82
+ application.logger.info("Kangas is running on startup")
83
+ else:
84
+ application.logger.info("Kangas is not running on startup")
85
+
86
  application.run(debug=True)