-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (23 loc) · 820 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
import asyncio
import sys
import setup.log
import setup.configuration
from services.discoveryservice import DiscoveryService
from services.emeterservice import EmeterService
configuration = setup.configuration.get_configuration()
logger = setup.log.get_logger('main')
discovery_service = DiscoveryService()
emeter_service = EmeterService(discovery_service)
async def main() -> None:
logger.info('Start fetching data.')
discovery_service.start()
emeter_service.start()
if __name__ == '__main__':
try:
asyncio.run(main())
except KeyboardInterrupt as e:
logger.info('Application shutdown requested by interruption.')
sys.exit(0)
except Exception as e:
logger.fatal('Something terrible happened!', exception=e)
sys.exit(1)