def wrapped():
     logger.debug(flask.request.data)
     param = json.loads(flask.request.data.decode())
     if 'action' in param and param['action'] == 'test':
         result = heartbeat_test(param, interface_name)
         return json.dumps(result, ensure_ascii=False)
     for key_param in key_params:
         if key_param not in param:
             result = param_error(param, interface_name)
             return json.dumps(result, ensure_ascii=False)
     log_event(param, '计算开始...', interface_name)
     logger.debug(json.dumps(param, indent=2, ensure_ascii=False))
     result = func(param)
     log_event(param, '计算完成', interface_name)
     return json.dumps(result, ensure_ascii=False, cls=CJsonEncoder)
Esempio n. 2
0
# coding=utf-8
from dmp.algor.machine_learning import ML
from dutil.log import logger

ml = ML()
while True:
    if ml.get_task():
        logger.debug('begin machine learning')
        ml.load_data()
        ml.execute_modle_fit()
        logger.debug('end machine learning')
Esempio n. 3
0
def cloud_guizhou_report():
    log.debug(flask.request.data)
    param = json.loads(flask.request.data)
    logger.debug(json.dumps(param, indent=2, ensure_ascii=False))
    return generate_cloudgz_report(param['user_id'], param['model_id'])