def get_excep_result():
    username = '******'
    password = '******'
    mongos_host = '10.68.112.11'
    mongos_port = 22001
    db_name = 'aihc'
    coll_name = 'stat_excep'
    period = 3600
    end_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    start_time = (
        datetime.datetime.now() +
        datetime.timedelta(minutes=-period)).strftime('%Y-%m-%d %H:%M:%S')
    host_mongo_query_exceptions = {}
    client = mongo_writer.auth(username, password, mongos_host, mongos_port)
    result_list = exception_stat_query.query_excep(client, db_name, coll_name,
                                                   start_time, end_time,
                                                   period)
    logger.info(f'result_list is {result_list}')
    if len(result_list) != 0:
        for doc in result_list:
            id_doc = doc.get("_id")
            result_doc = id_doc
            result_doc.update({'count': doc.get('count')})
            new_id = id_doc.get('Ip') + '—' + id_doc.get('FunctionName')
            result_doc.update({'_id': new_id})
            logger.info(f'result_doc is {result_doc}')

            if host_mongo_query_exceptions is not None and host_mongo_query_exceptions.__contains__(
                    new_id):
                excep_doc = host_mongo_query_exceptions.get(new_id)
                context_old = excep_doc.get('context')
                context_new = result_doc.get('ExceptionType') + "," + str(
                    result_doc.get('count'))
                excep_doc.update({'context': context_old + ',' + context_new})
                print(excep_doc)
                excep_doc.update({
                    'sumCount':
                    (result_doc.get('count') + excep_doc.get('sumCount'))
                })
            else:
                result_doc.update({
                    'context':
                    result_doc.get('ExceptionType') + "," +
                    str(result_doc.get('count'))
                })
                result_doc.update({'sumCount': result_doc.get('count')})
                host_mongo_query_exceptions.update({new_id: result_doc})
    excep_result_value = host_mongo_query_exceptions.values()
    excep_result = sorted(excep_result_value,
                          key=lambda x: x['Ip'],
                          reverse=False)
    logger.info(f'excep_result is {excep_result}')
    return excep_result
    username = '******'
    password = '******'
    mongos_host = '10.19.85.33'
    mongos_port = 34000
    db_name = 'test'
    coll_name = 'stat_excep'
    period = 200
    host_mongo_query_exceptions = {}
    excep_result = []
    client = mongo_writer.auth(username, password, mongos_host, mongos_port)
    end_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    start_time = (
        datetime.datetime.now() +
        datetime.timedelta(minutes=-period)).strftime('%Y-%m-%d %H:%M:%S')
    result_list = exception_stat_query.query_excep(client, db_name, coll_name,
                                                   start_time, end_time,
                                                   period)
    logging.info(f'result_list is {result_list}')
    if len(result_list) != 0:
        for doc in result_list:
            id_doc = doc.get("_id")
            result_doc = id_doc
            result_doc.update({'count': doc.get('count')})
            new_id = id_doc.get('Ip') + '—' + id_doc.get('FunctionName')
            result_doc.update({'_id': new_id})
            logging.info(f'result_doc is {result_doc}')

            if host_mongo_query_exceptions is not None and host_mongo_query_exceptions.__contains__(
                    new_id):
                excep_doc = host_mongo_query_exceptions.get(new_id)
                context_old = excep_doc.get('context')