Exemplo n.º 1
0
def reducer(intermediate_output, opts, jobid):
    logger.debug("reducer()")
    out_histo = defaultdict(int)
    for oid in intermediate_output:
        if oid:
            histo = api.retrieve(name, oid, opts)
            out_histo = merge_histo(histo, out_histo)
    api.store(name, jobid, out_histo, opts)
    return out_histo          
Exemplo n.º 2
0
def mapper(oid, opts, jobid=False):
    logger.debug("mapper()")

    if api.exists(name, oid, opts):
        return oid
    functions = api.retrieve("function_extract", oid)
    if not functions:
        return None
    out_histo = defaultdict(int)
    for f in functions:
        l = calls(functions[f])
        out_histo = merge_histo(out_histo, l)
    api.store(name, oid, out_histo, opts)
    return oid