Firehose¶
- class passengersim.driver.Firehose[source]¶
Bases:
objectMixin for attaching and retrieving simulation firehose outputs.
This helper expects subclasses to provide an
engattribute with the core firehose logger methods. Writable destinations are cached locally so buffered output can be retrieved after the engine flushes pending messages.Methods
__init__()attach_firehose(topic, destination)Attach a firehose logger destination for a topic.
get_firehose(topic)Return the cached writable firehose destination for a topic.
Attributes
- eng : SimulationEngine¶
- attach_firehose(topic: str, destination: str | bool | TextIO | None) None[source]¶
Attach a firehose logger destination for a topic.
- Parameters:
- topic : str¶
Firehose topic name to route from the simulation engine.
- destination : str or bool or file-like or None¶
Destination passed through to the engine. Writable destinations are also stored locally so they can be returned by
get_firehose().
- get_firehose(topic: str) TextIO | None[source]¶
Return the cached writable firehose destination for a topic.
- Parameters:
- topic : str¶
Firehose topic name to look up.
- Returns:
TextIO or None – The cached writable destination for
topic, if one was attached.
Notes
Pending firehose log output is flushed from the engine before the cached destination is returned.