예제 #1
0
def identify_task_exist(task_id):
    status = True
    try:
        task_exist_result = es_group_result.get(index=group_index_name, doc_type=group_index_type, id=task_id)['_source']
    except:
        task_exist_result = {}
    if task_exist_result != {}:
        status = True
    return status
예제 #2
0
def exist(task_id):
    try:
        task_exist = es.get(index=index_name, doc_type=index_type,
                            id=task_id)['_source']
    except:
        task_exist = {}
    if not task_exist:
        return False
    else:
        if task_exist['status'] == 1:
            return False
        return True
예제 #3
0
def change_process_proportion(task_id, proportion):
    mark = False
    try:
        task_exist_result = es_group_result.get(index=group_index_name, doc_type=group_index_type, id=task_id)['_source']
    except:
        task_exist_result = {}
        return 'task is not exist'
    if task_exist_result != {}:
        task_exist_result['detect_process'] = proportion
        es_group_result.index(index=group_index_name, doc_type=group_index_type, id=task_id, body=task_exist_result)
        mark = True

    return mark
예제 #4
0
def save_detect_results(detect_results, task_id):
    mark = False
    try:
        task_exist_result = es_group_result.get(index=group_index_name, doc_type=group_index_type, id=task_id)['_source']
    except:
        task_exist_result = {}
    if task_exist_result != {}:
        task_exist_result['uid_list'] = json.dumps(detect_results)
        task_exist_result['detect_process'] = 100
        es_group_result.index(index=group_index_name, doc_type=group_index_type, id=task_id, body=task_exist_result)
        mark = True

    return mark
예제 #5
0
def save_group_results(results):
    status = False
    # step1: identify the task is exist
    try:
        task_exist_result = es.get(index=index_name, doc_type=index_type, id=results["task_name"])["_source"]
    except:
        task_exist_result = {}

    # step2: save result
    if task_exist_result != {}:
        es.index(index=index_name, doc_type=index_type, body=results, id=results["task_name"])
        status = True

    return status
def save_group_results(results):
    status = False
    submit_user = results['submit_user']
    task_name = results['task_name']
    task_id = results['task_id']
    #step1: identify the task is exist
    try:
        task_exist_result = es.get(index=index_name, doc_type=index_type, id=task_id)['_source']
    except:
        task_exist_result = {}

    #step2: save result
    #if task_exist_result != {}:
    es.index(index=index_name, doc_type=index_type, body=results, id=task_id)
    status = True
    print 'save group results:', status
    return status
예제 #7
0
def save_group_results(results):
    status = False
    submit_user = results['submit_user']
    task_name = results['task_name']
    task_id = results['task_id']
    #step1: identify the task is exist
    try:
        task_exist_result = es.get(index=index_name,
                                   doc_type=index_type,
                                   id=task_id)['_source']
    except:
        task_exist_result = {}

    #step2: save result
    #if task_exist_result != {}:
    es.index(index=index_name, doc_type=index_type, body=results, id=task_id)
    status = True
    print 'save group results:', status
    return status
예제 #8
0
def save_group_results(results):
    status = False
    #step1: identify the task is exist
    try:
        task_exist_result = es.get(index=index_name,
                                   doc_type=index_type,
                                   id=results['task_name'])['_source']
    except:
        task_exist_result = {}

    #step2: save result
    if task_exist_result != {}:
        es.index(index=index_name,
                 doc_type=index_type,
                 body=results,
                 id=results['task_name'])
        status = True

    return status