def gen_model_operation_job_config(config_data: dict, model_operation: ModelOperation): job_runtime_conf = runtime_conf_basic(if_local=True) initiator_role = "local" job_dsl = {"components": {}} if model_operation in [ModelOperation.STORE, ModelOperation.RESTORE]: component_name = "{}_0".format(model_operation) component_parameters = dict() component_parameters.update(config_data) for k, v in config_data.items(): component_parameters[k] = [v] if "store_address" not in config_data: component_parameters["store_address"] = [ DEFAULT_MODEL_STORE_ADDRESS ] job_runtime_conf["role_parameters"][initiator_role] = { component_name: component_parameters } job_dsl["components"][component_name] = { "module": "Model{}".format(model_operation.capitalize()) } else: raise Exception( "Can not support this model operation: {}".format(model_operation)) return job_dsl, job_runtime_conf
def gen_model_operation_job_config(config_data: dict, model_operation: ModelOperation): job_runtime_conf = job_utils.runtime_conf_basic(if_local=True) initiator_role = "local" job_dsl = {"components": {}} if model_operation in [ModelOperation.STORE, ModelOperation.RESTORE]: component_name = "{}_0".format(model_operation) component_parameters = dict() component_parameters["model_id"] = [config_data["model_id"]] component_parameters["model_version"] = [config_data["model_version"]] component_parameters["store_address"] = [MODEL_STORE_ADDRESS] if model_operation == ModelOperation.STORE: component_parameters["force_update"] = [ config_data.get("force_update", False) ] job_runtime_conf["role_parameters"][initiator_role] = { component_name: component_parameters } job_dsl["components"][component_name] = { "module": "Model{}".format(model_operation.capitalize()) } else: raise Exception( "Can not support this model operation: {}".format(model_operation)) return job_dsl, job_runtime_conf
def gen_model_operation_job_config(config_data: dict, model_operation: ModelOperation): if model_operation not in {ModelOperation.STORE, ModelOperation.RESTORE}: raise Exception( "Can not support this model operation: {}".format(model_operation)) component_name = f"{str(model_operation).replace('.', '_').lower()}_0" job_dsl = { "components": { component_name: { "module": "Model{}".format(model_operation.value.capitalize()), }, }, } job_runtime_conf = job_utils.runtime_conf_basic(True) component_parameters = { "model_id": config_data["model_id"], "model_version": config_data["model_version"], "store_address": ServiceRegistry.MODEL_STORE_ADDRESS, } if model_operation == ModelOperation.STORE: component_parameters["force_update"] = config_data.get( "force_update", False) job_runtime_conf["component_parameters"]["role"] = { "local": { "0": { component_name: component_parameters, }, }, } return job_dsl, job_runtime_conf