def do_load_model():
    request_data = request.json
    request_data["servings"] = CenterConfig.get_settings(path=SERVING_PATH, servings_zk_path=SERVINGS_ZK_PATH,
                                                         use_zk=USE_CONFIGURATION_CENTER, hosts=ZOOKEEPER_HOSTS,
                                                         server_conf_path=SERVER_CONF_PATH)
    load_status = publish_model.load_model(config_data=request_data)
    return get_json_result(retcode=(0 if load_status else 101))
def bind_model_service():
    request_config = request.json
    if not request_config.get('servings'):
        # get my party all servings
        request_config['servings'] = CenterConfig.get_settings(path=SERVING_PATH, servings_zk_path=SERVINGS_ZK_PATH,
                                                               use_zk=USE_CONFIGURATION_CENTER, hosts=ZOOKEEPER_HOSTS,
                                                               server_conf_path=SERVER_CONF_PATH)
    if not request_config.get('service_id'):
        return get_json_result(retcode=101, retmsg='no service id')
    bind_status, service_id = publish_model.bind_model_service(config_data=request_config)
    return get_json_result(retcode=(0 if bind_status else 101), retmsg='service id is {}'.format(service_id))
Ejemplo n.º 3
0
CLUSTER_STANDALONE_JOB_SERVER_PORT = 9381

# services ip and port
SERVER_CONF_PATH = 'arch/conf/server_conf.json'
SERVING_PATH = '/servers/servings'
server_conf = file_utils.load_json_conf(SERVER_CONF_PATH)
PROXY_HOST = server_conf.get(SERVERS).get('proxy').get('host')
PROXY_PORT = server_conf.get(SERVERS).get('proxy').get('port')
BOARD_HOST = server_conf.get(SERVERS).get('fateboard').get('host')
if BOARD_HOST == 'localhost':
    BOARD_HOST = get_lan_ip()
BOARD_PORT = server_conf.get(SERVERS).get('fateboard').get('port')
MANAGER_HOST = server_conf.get(SERVERS).get('fatemanager', {}).get('host')
MANAGER_PORT = server_conf.get(SERVERS).get('fatemanager', {}).get('port')
SERVINGS = CenterConfig.get_settings(path=SERVING_PATH,
                                     servings_zk_path=SERVINGS_ZK_PATH,
                                     use_zk=USE_CONFIGURATION_CENTER,
                                     hosts=ZOOKEEPER_HOSTS,
                                     server_conf_path=SERVER_CONF_PATH)
BOARD_DASHBOARD_URL = 'http://%s:%d/index.html#/dashboard?job_id={}&role={}&party_id={}' % (
    BOARD_HOST, BOARD_PORT)

# switch
SAVE_AS_TASK_INPUT_DATA_SWITCH = True
SAVE_AS_TASK_INPUT_DATA_IN_MEMORY = True

# init
RuntimeConfig.init_config(WORK_MODE=WORK_MODE)
RuntimeConfig.init_config(HTTP_PORT=HTTP_PORT)
RuntimeConfig.init_config(BACKEND=BACKEND)