vivarium.core.emitter module

class vivarium.core.emitter.DatabaseEmitter(config)[source]

Bases: vivarium.core.emitter.Emitter

Emit data to a mongoDB database

Example:

>>> config = {
...     'host': 'localhost:27017',
...     'database': 'DB_NAME',
... }
>>> # The line below works only if you have to have 27017 open locally
>>> # emitter = DatabaseEmitter(config)
client = None
default_host = 'localhost:27017'
emit(data_config)[source]
get_data()[source]
class vivarium.core.emitter.Emitter(config)[source]

Bases: object

Emit data to terminal

emit(data)[source]
get_data()[source]
get_path_timeseries()[source]
get_timeseries()[source]
class vivarium.core.emitter.KafkaEmitter(config)[source]

Bases: vivarium.core.emitter.Emitter

Emit data to kafka

Example:

>>> config = {
...     'host': 'localhost:9092',
...     'topic': 'EMIT',
... }
>>> emitter = KafkaEmitter(config)
emit(data)[source]
class vivarium.core.emitter.NullEmitter(config)[source]

Bases: vivarium.core.emitter.Emitter

Don’t emit anything

emit(data)[source]
class vivarium.core.emitter.TimeSeriesEmitter(config)[source]

Bases: vivarium.core.emitter.Emitter

emit(data)[source]
get_data()[source]
vivarium.core.emitter.configure_emitter(config, processes, topology)[source]
vivarium.core.emitter.create_indexes(table, columns)[source]

Create all of the necessary indexes for the given table name.

vivarium.core.emitter.data_from_database(experiment_id, client)[source]
vivarium.core.emitter.delivery_report(err, msg)[source]

This is a utility method passed to the Kafka Producer to handle the delivery of messages sent using send(topic, message).

vivarium.core.emitter.emit_environment_config(environment_config, emitter)[source]
vivarium.core.emitter.get_atlas_client(secrets_path)[source]
vivarium.core.emitter.get_atlas_database_emitter_config(username, password, cluster_subdomain, database)[source]
vivarium.core.emitter.get_emitter(config)[source]

Get an emitter based on the provided config.

The available emitter type names and their classes are:

Parameters

config (dict) – Requires three keys: * type: Type of emitter (‘kafka’ for a kafka emitter). * emitter: Any configuration the emitter type requires to initialize. * keys: A list of state keys to emit for each state label.

Returns

An instantiated emitter.

Return type

Emitter

vivarium.core.emitter.get_history_data_db(history_collection, experiment_id)[source]
vivarium.core.emitter.get_local_client(host, port, database_name)[source]
vivarium.core.emitter.path_timeseries_from_data(data)[source]
vivarium.core.emitter.path_timeseries_from_embedded_timeseries(embedded_timeseries)[source]
vivarium.core.emitter.time_indexed_timeseries_from_data(data)[source]
vivarium.core.emitter.timeseries_from_data(data)[source]