panobbgo.core.EventBus#
- class panobbgo.core.EventBus(config: Any)[source]#
Publish/subscribe bus connecting the strategy, its analyzers and its heuristics. E.g. the “new best point” information is sent to every subscribing heuristic.
Delivery is serial and ordered: one dispatcher thread pops events from a single FIFO and calls the subscribers’
on_<key>handlers one after the other, in subscription order. Events published by a handler are appended to the same FIFO. Consequentlya module never has two handlers running at the same time, so module state needs no locking;
the sequence of handler invocations is a pure function of the sequence of
publishcalls — the property the seeded, reproducible runs rely on (seewait_idle());handlers must return promptly. A module reacts to events; it never sleeps, polls or waits for other events inside a handler.
Methods
__init__(config)publish(key[, event, terminate])Publishes a new
Eventto all subscribers, who listen to the givenkey.register(target)Registers a given
targetfor this EventBus instance: everyon_<key>method it has becomes a subscription tokey.subscribe(key, target)Called by
register().unsubscribe(key, target)Args:
Attributes