aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/pmsh-pnf-sim/docker-compose/schedulepmjob.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocks/pmsh-pnf-sim/docker-compose/schedulepmjob.py')
-rw-r--r--test/mocks/pmsh-pnf-sim/docker-compose/schedulepmjob.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/test/mocks/pmsh-pnf-sim/docker-compose/schedulepmjob.py b/test/mocks/pmsh-pnf-sim/docker-compose/schedulepmjob.py
index 2c6c587ed..2e916deb5 100644
--- a/test/mocks/pmsh-pnf-sim/docker-compose/schedulepmjob.py
+++ b/test/mocks/pmsh-pnf-sim/docker-compose/schedulepmjob.py
@@ -1,16 +1,28 @@
#!/usr/bin/env python3
-
+import logging.config
+import os
+import sys
import time
+
import schedule
+import yaml
+
+from app_config import pnfconfig
from pnf import PNF
-import pnfconfig
+
+log_file_path = os.path.join(os.path.dirname(__file__), 'app_config/logger_config.yaml')
+with open(log_file_path, 'r') as f:
+ log_cfg = yaml.safe_load(f.read())
+logging.config.dictConfig(log_cfg)
+logger = logging.getLogger('dev')
if __name__ == "__main__":
try:
- pnf = PNF()
- schedule.every(pnfconfig.ROP).seconds.do(pnf.pm_job)
+ schedule.every(pnfconfig.ROP).seconds.do(PNF.pm_job)
+ logger.info('Starting PM scheduling job')
while True:
schedule.run_pending()
time.sleep(1)
except Exception as error:
- print(error)
+ logger.debug(error)
+ sys.exit(1)