in src/vw-serving/src/vw_serving/sagemaker/integration.py [0:0]
def get_configuration(default_conf, schema):
"""
Returns a dictionary containing learning algorithm parameters.
The returned configuration dictionary merges customer-specified parameters
with default_conf & validates the schema.
:param default_conf: pass the default config
:param schema: schema to conform to
:return: a dictionary of algorithm arguments
"""
global _config
if not _config:
validator = ConfigValidator(schema)
try:
with open(default_conf, 'r') as def_conf_file:
_config = json.load(def_conf_file)
logging.info("Reading default configuration from %s: %s",
def_conf_file.name, _config)
train_path = TRAIN_CONFIG_FILE_PATH
with open(train_path, 'r') as train_conf_file:
train_config = json.load(train_conf_file)
logging.info("Reading provided configuration from %s: %s",
train_conf_file.name, train_config)
_config.update(train_config)
except IOError as e:
logging.info("content of %s is %s", INPUT_VOLUME, os.listdir(INPUT_VOLUME))
logging.info("content of %s is %s", os.path.join(INPUT_VOLUME, CONFIG_DIR),
os.listdir(os.path.join(INPUT_VOLUME, CONFIG_DIR)))
raise PlatformError(message='Could not read configuration files from: {}'.format([default_conf,
TRAIN_CONFIG_FILE_PATH]),
caused_by=e)
try:
validator.validate(_config)
except Exception:
_config = None
raise
logging.info("Final configuration: %s", _config)
return _config