-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbasic_primary.py
26 lines (18 loc) · 908 Bytes
/
basic_primary.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
#!/usr/bin/env python3
import os
import configparser
from RpiCluster.MainLogger import add_file_logger
from RpiCluster.PrimaryNodes.RpiPrimary import RpiPrimary
from RpiCluster.NodeConfig import NodeConfig
config = configparser.ConfigParser()
config.read(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'rpicluster.cfg'))
NodeConfig.load(config)
socket_port = config.getint("primary", "socket_port")
socket_bind_ip = config.get("primary", "socket_bind_ip")
influxdb_host = config.get("primary", "influxdb_host")
influxdb_port = config.get("primary", "influxdb_port")
influxdb_database_prefix = config.get("primary", "influxdb_database_prefix")
add_file_logger("primary.log")
# The RpiPrimary class handles all of the interesting bits of work that the primary performs
primary = RpiPrimary(socket_bind_ip, socket_port, influxdb_host, influxdb_port, influxdb_database_prefix)
primary.start()