lineapy.system_tracing package
Submodules
lineapy.system_tracing.exec_and_record_function_calls module
lineapy.system_tracing.function_call module
lineapy.system_tracing.function_calls_to_side_effects module
- lineapy.system_tracing.function_calls_to_side_effects.function_calls_to_side_effects(function_inspector: FunctionInspector, function_calls: Iterable[FunctionCall], input_nodes: Mapping[LineaID, object], output_globals: Mapping[str, object]) Iterable[Union[MutatedNode, ViewOfNodes, AccessedGlobals, ImplicitDependencyNode]] [source]
Translates a list of function calls to a list of side effects, by mapping objects to nodes.
- Parameters
function_inspector – The function inspector to use to lookup what side effects each function call has.
function_calls – The function calls that were recorded.
input_nodes – Mapping of node ID to value for all the nodes that were passed in to this execution.
output_globals – Mapping of global identifier to the value of all globals that were set during this execution.
Module contents
This module adds support for using sys.settrace to understand what happens during a subset of code execution that’s passed in. In the context of how it’s currently used, it’s limited to the “blackbox” execs—l_exec_statement It can be used used and tested independently.
At a high level, users could:
Use the exec_and_record_function_calls.py as an entry point and uses sys.settrace to trace every bytecode execution and _op_stack.py to look at the bytecode stack during tracing. It translates different bytecode instructions into the corresponding Python function calls.
Use function_calls_to_side_effects.py to translate the sequence of calls that were recorded into the side effects produced on nodes (mapping Python changes to graph changes).