Exemplo n.º 1
0
def rabbit_with_log(papers, check_invalid_papers, log_comment, partial=False):
    from invenio.bibauthorid_rabbit import rabbit

    personids_to_update_extids = _get_personids_to_update_extids(papers)
    starting_time = get_sql_time()
    rabbit(papers, check_invalid_papers, personids_to_update_extids)
    if partial:
        action = 'PID_UPDATE_PARTIAL'
    else:
        action = 'PID_UPDATE'
    insert_user_log('daemon', '-1', action, 'bibsched', 'status', comment=log_comment, timestamp=starting_time)
Exemplo n.º 2
0
def run_tortoise(from_scratch,
                 last_names_thresholds=None,
                 single_threaded=False):

    _prepare_tortoise_cache()


    from invenio.bibauthorid_tortoise import tortoise, \
        tortoise_from_scratch, tortoise_last_name, tortoise_last_names

    if single_threaded and last_names_thresholds:
        for last_name, threshold in last_names_thresholds.items():
            tortoise_last_name(last_name,
                               wedge_threshold=threshold,
                               from_mark=from_scratch)
    elif last_names_thresholds:
        names_with_args = list()
        for last_name, threshold in last_names_thresholds.items():
            kwargs = dict()
            if from_scratch:
                kwargs['from_mark'] = from_scratch
            else:
                kwargs['pure'] = from_scratch
            if threshold:
                args = (last_name, threshold)
            else:
                args = (last_name, )
            names_with_args.append((args, kwargs))
        tortoise_last_names(names_with_args)
    elif from_scratch:
        tortoise_from_scratch()
    else:
        start_time = get_db_time()
        tortoise_db_name = 'tortoise'

        last_run = get_user_logs(userinfo=tortoise_db_name,
                                 only_most_recent=True)
        if last_run:
            modified = get_modified_papers_since(last_run[0][2])
        else:
            modified = []
        tortoise(modified)

        insert_user_log(tortoise_db_name,
                        '-1',
                        '',
                        '',
                        '',
                        timestamp=start_time)
Exemplo n.º 3
0
def rabbit_with_log(papers, check_invalid_papers, log_comment, partial=False):
    from invenio.bibauthorid_rabbit import rabbit

    personids_to_update_extids = _get_personids_to_update_extids(papers)
    starting_time = get_db_time()
    rabbit(papers, check_invalid_papers, personids_to_update_extids)
    if partial:
        action = 'PID_UPDATE_PARTIAL'
    else:
        action = 'PID_UPDATE'
    insert_user_log('daemon',
                    '-1',
                    action,
                    'bibsched',
                    'status',
                    comment=log_comment,
                    timestamp=starting_time)
Exemplo n.º 4
0
def run_tortoise(from_scratch):
    from invenio.bibauthorid_tortoise import tortoise, tortoise_from_scratch

    if from_scratch:
        tortoise_from_scratch()
    else:
        start_time = get_sql_time()
        tortoise_db_name = 'tortoise'

        last_run = get_user_log(userinfo=tortoise_db_name, only_most_recent=True)
        if last_run:
            modified = get_recently_modified_record_ids(last_run[0][2])
        else:
            modified = []
        tortoise(modified)

    insert_user_log(tortoise_db_name, '-1', '', '', '', timestamp=start_time)
Exemplo n.º 5
0
def run_tortoise(from_scratch):
    from invenio.bibauthorid_tortoise import tortoise, tortoise_from_scratch

    if from_scratch:
        tortoise_from_scratch()
    else:
        start_time = get_db_time()
        tortoise_db_name = 'tortoise'

        last_run = get_user_logs(userinfo=tortoise_db_name,
                                 only_most_recent=True)
        if last_run:
            modified = get_modified_papers_since(last_run[0][2])
        else:
            modified = []
        tortoise(modified)

    insert_user_log(tortoise_db_name, '-1', '', '', '', timestamp=start_time)