5 from osm_policy_module
.core
.config
import Config
7 from osm_policy_module
.core
.agent
import PolicyModuleAgent
11 cfg
= Config
.instance()
12 parser
= argparse
.ArgumentParser(prog
='pm-scaling-config-agent')
13 parser
.add_argument('--config-file', nargs
='?', help='Policy module agent configuration file')
14 args
= parser
.parse_args()
16 cfg
.load_file(args
.config_file
)
17 if cfg
.get('policy_module', 'log_dir') == 'stdout':
18 logging
.basicConfig(stream
=sys
.stdout
,
19 format
='%(asctime)s %(message)s',
20 datefmt
='%m/%d/%Y %I:%M:%S %p',
21 level
=logging
._nameToLevel
[cfg
.get('policy_module', 'log_level')])
23 logging
.basicConfig(filename
=cfg
.get('policy_module', 'log_dir') + 'pm_agent.log',
24 format
='%(asctime)s %(message)s',
25 datefmt
='%m/%d/%Y %I:%M:%S %p', filemode
='a',
26 level
=logging
._nameToLevel
[cfg
.get('policy_module', 'log_level')])
27 log
= logging
.getLogger(__name__
)
28 log
.info("Starting policy module agent...")
29 agent
= PolicyModuleAgent()