forked from lossless1024/StreaMonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDownloader.py
43 lines (31 loc) · 1.07 KB
/
Downloader.py
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
import os
import sys
import streamonitor.config as config
from streamonitor.managers.httpmanager import HTTPManager
from streamonitor.managers.climanager import CLIManager
from streamonitor.managers.zmqmanager import ZMQManager
from streamonitor.managers.outofspace_detector import OOSDetector
from streamonitor.clean_exit import CleanExit
import streamonitor.sites # must have
def is_docker():
path = '/proc/self/cgroup'
return (
os.path.exists('/.dockerenv') or
os.path.isfile(path) and any('docker' in line for line in open(path))
)
def main():
if not OOSDetector.disk_space_good():
print(OOSDetector.under_threshold_message)
sys.exit(1)
streamers = config.loadStreamers()
clean_exit = CleanExit(streamers)
oos_detector = OOSDetector(streamers)
oos_detector.start()
if not is_docker():
console_manager = CLIManager(streamers)
console_manager.start()
zmq_manager = ZMQManager(streamers)
zmq_manager.start()
http_manager = HTTPManager(streamers)
http_manager.start()
main()