blob: 2e916deb5f9c3cac30e227ff7753af3cb8daf57a [file] [log] [blame]
rajendrajaiswal318533f2020-03-09 15:41:41 +00001#!/usr/bin/env python3
efiacore6e9e792020-07-10 14:58:50 +01002import logging.config
3import os
4import sys
rajendrajaiswal6a61ad82019-12-16 14:24:02 +00005import time
efiacore6e9e792020-07-10 14:58:50 +01006
rajendrajaiswal6a61ad82019-12-16 14:24:02 +00007import schedule
efiacore6e9e792020-07-10 14:58:50 +01008import yaml
9
10from app_config import pnfconfig
rajendrajaiswal6a61ad82019-12-16 14:24:02 +000011from pnf import PNF
efiacore6e9e792020-07-10 14:58:50 +010012
13log_file_path = os.path.join(os.path.dirname(__file__), 'app_config/logger_config.yaml')
14with open(log_file_path, 'r') as f:
15 log_cfg = yaml.safe_load(f.read())
16logging.config.dictConfig(log_cfg)
17logger = logging.getLogger('dev')
rajendrajaiswal6a61ad82019-12-16 14:24:02 +000018
19if __name__ == "__main__":
20 try:
efiacore6e9e792020-07-10 14:58:50 +010021 schedule.every(pnfconfig.ROP).seconds.do(PNF.pm_job)
22 logger.info('Starting PM scheduling job')
rajendrajaiswal6a61ad82019-12-16 14:24:02 +000023 while True:
24 schedule.run_pending()
25 time.sleep(1)
26 except Exception as error:
efiacore6e9e792020-07-10 14:58:50 +010027 logger.debug(error)
28 sys.exit(1)