Skip to content

invoker

invoker

Invoker

Invoker(tracer: InterleavingTracer, *args, **kwargs)

Bases: Tracer

Extends the Tracer class to invoke intervention functions.

This class captures code blocks and compiles them into intervention functions that can be executed by the Interleaver.

PARAMETER DESCRIPTION
tracer

The parent InterleavingTracer instance

TYPE: InterleavingTracer

*args

Additional arguments to pass to the traced function

DEFAULT: ()

**kwargs

Additional keyword arguments to pass to the traced function

DEFAULT: {}

tracer instance-attribute

tracer = tracer

compile

compile()

Compile the captured code block into an intervention function.

The function is wrapped with try-catch logic to handle exceptions and signal completion to the mediator.

RETURNS DESCRIPTION

A callable intervention function

execute

execute(fn: Callable)

Execute the compiled intervention function.

Creates a new Mediator for the intervention function and adds it to the parent tracer's mediators list.

PARAMETER DESCRIPTION
fn

The compiled intervention function

TYPE: Callable