Exemple #1
0
def claim(typ, **info):
    '''
    Add an entry to the provenance stack for the duration of the context
    '''
    stack = s_task.varget('provstack')

    if len(stack) > 256:
        baseframe = stack.provs[1]
        recent_frames = stack.provs[-6:]
        raise s_exc.RecursionLimitHit(
            mesg='Hit provenance claim recursion limit',
            type=typ,
            info=info,
            baseframe=baseframe,
            recent_frames=recent_frames)

    if not ProvenanceEnabled:
        info = {}

    stack.push(typ, **info)

    try:
        yield
    finally:
        stack.pop()
    def _recursion_check(self):

        depth = RecursionDepth.get()
        if depth > 64:
            raise s_exc.RecursionLimitHit(mesg='Hit trigger limit')
        token = RecursionDepth.set(depth + 1)

        try:
            yield

        finally:
            RecursionDepth.reset(token)
Exemple #3
0
def claim(typ, **info):
    '''
    Add an entry to the provenance stack for the duration of the context
    '''
    stack = s_task.varget('provstack')

    if len(stack) > 256:  # pragma: no cover
        raise s_exc.RecursionLimitHit(mesg='Hit global recursion limit')

    stack.push(typ, **info)

    try:
        yield
    finally:
        stack.pop()