Exemplo n.º 1
0
def calculate_colls(coll_args: coll_calc.CollCalcArgs):
    """
    """
    ans = coll_calc.calculate_colls_bg(coll_args)
    if not ans['processing'] and len(ans['data']['Items']) > 0:
        with open(coll_args.cache_path, 'wb') as f:
            pickle.dump(ans['data'], f)
    return ans
Exemplo n.º 2
0
def calculate_colls(coll_args):
    """
    arguments:
    coll_args -- dict-serialized coll_calc.CollCalcArgs
    """
    coll_args = coll_calc.CollCalcArgs(**coll_args)
    calculate_colls.cache_path = coll_args.cache_path
    ans = coll_calc.calculate_colls_bg(coll_args)
    trigger_cache_limit = settings.get_int('corpora', 'colls_cache_min_lines', 10)
    if not ans['processing'] and len(ans['data']['Items']) >= trigger_cache_limit:
        calculate_colls.cache_data = ans['data']
    else:
        calculate_colls.cache_data = None
    return ans