-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
32 lines (27 loc) · 968 Bytes
/
main.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
import configparser
from core.processor import DataProcessor
from core.stack import Stack
from usr_func import *
if __name__ == '__main__':
# read configuration from file
config = configparser.ConfigParser()
config.read('config/port.ini')
# create data processors for each data source
processors = []
for section in config.sections():
host = config.get(section, 'host')
port = config.getint(section, 'port')
process_func = globals()[config.get(section, 'process_func')]
processor = DataProcessor(host, port, process_func)
processors.append(processor)
# start data processors
for processor in processors:
processor.start()
stack = Stack(par_namelist)
# main loop to process data
while True:
for processor in processors:
data = processor.get_data()
if data is not None:
stack.get(data)
print(stack.get_bias())