libtcspc.ExecutionContext

class libtcspc.ExecutionContext(compiled_graph, arguments=None, downstreams=None)[source]

Bases: object

An execution context for a compiled processing graph.

This object encapsulates a single run of stream processing and cannot be reused.

Parameters:
  • compiled_graph (CompiledGraph) – The compiled graph from which to instantiate the processor.

  • arguments (dict[str, Any] or None) – The values that parameters should bind to, keyed by Param name. None (the default) means all parameters use their defaults.

  • downstreams (Sequence[PySink] | None)

access(tag)[source]

Obtain run-time access to components of the processing graph.

Parameters:

tag (AccessTag) – The access tag.

Returns:

The accessor for the requested tag. The concrete protocol (e.g., AcquireAccessor, CountAccessor) depends on the node type that was tagged.

Return type:

Accessor

cpp_to_graphviz()[source]

Return a Graphviz dot representation of the compiled C++ processor graph.

Unlike Graph.to_graphviz, which describes the Python-side graph before compilation, this method introspects the actual C++ processor graph that was instantiated by code generation. Convenience helpers (such as read_events_from_binary_file) and Subgraph nodes are fully expanded.

The output is intended for debugging and visualization only. The exact format is not stable and should not be consumed programmatically.

Returns:

A complete digraph G { ... } block in Graphviz DOT format.

Return type:

str

Notes

Safe to call at any point during the context’s lifetime: before handle(), between calls, or after flush() / EndOfProcessing. The method does not interact with the processor’s end-of-life state (consistent with access()).

flush()[source]

Flush the processor input.

Raises:

EndOfProcessing – If the processor detected the end of the stream (of interest).

Return type:

None

handle(event)[source]

Send an event to the processor input.

Parameters:

event (Any) – The event.

Raises:

EndOfProcessing – If the processor detected the end of the stream (of interest).

Return type:

None