ecoli.processes.engine_process

EngineProcess

Tunnel Ports

Sometimes, a process inside the EngineProcess might need to be wired to a store outside the EngineProcess, or an outside process might need to be wired to an inside store. We handle this with _tunnels_.

Here is a state hierarchy showing how a tunnel connects an outside process (A) to an inside store (store1). We call this a “tunnel in” because the exterior process is tunneling into EngineProcess to see an internal store.

      /\
     /  \         EngineProcess
 +---+   +-------------------------+
 | A |   |                         |
 +---+   |        /\               |
   :     |       /  \              |
   :     |  +---+    store1        |
...:     |  | B |       ^          |
:        |  +---+       |          |
:        |              |          |
:..tunnel_outer <----- next_update |
         |                         |
         +-------------------------+

Here is another example where a tunnel connects an inside process (B) to an outside store (store2). We call this a “tunnel out” because the interior process is tunneling outside of EngineProcess to see an external store.

      /\
     /  \         EngineProcess
    /    +-------------------------+
 store2  |                         |
   :     |        /\               |
   :     |       /  \              |
   :     |  +---+    tunnel_inner  |
...:     |  | B |.......:    ^     |
:        |  +---+            |     |
:        |                   |     |
:..tunnel_outer <----- next_update |
         |                         |
         +-------------------------+

In these diagrams, processes are boxes, stores are labeled nodes in the tree, solid lines show the state hierarchy, and dotted lines show the topology wiring.

These tunnels are the only way that the EngineProcess exchanges information with the outside simulation.

class ecoli.processes.engine_process.EngineProcess(parameters=None)[source]

Bases: Process

calculate_timestep(states)[source]
create_emitter()[source]
defaults: Dict[str, Any]
{   'agent_id': '0',
    'divide': False,
    'division_threshold': None,
    'division_variable': None,
    'emit_paths': (),
    'experiment_id': '',
    'inner_composer': None,
    'inner_composer_config': {},
    'inner_emitter': 'null',
    'inner_same_timestep': False,
    'outer_composer': None,
    'outer_composer_config': {},
    'seed': 0,
    'start_time': 0,
    'stub_schemas': {},
    'tunnel_out_schemas': {},
    'tunnels_in': {}}
initial_state(config=None)[source]
next_update(timestep, states)[source]
ports_schema()[source]
send_command(command, args=None, kwargs=None, run_pre_check=True)[source]

Override to handle special command ‘get_inner_state’ which lets engine process pull out a dictionary containing the entire inner simulation state.

Return type:

None

class ecoli.processes.engine_process.SchemaStub(parameters=None)[source]

Bases: Step

Stub process for providing schemas to an inner simulation. Run as a Step otherwise its timestep could influence when other Steps run. For example, if a SchemaStub was a process with timestep 1 while all other processes had timestep 2, Steps like mass listener would run after every second instead of every 2 seconds, wasting time.

When using ecoli.processes.engine_process.EngineProcess, there may be processes in the outer simulation whose schemas you are expecting to affect variables in the inner simulation. You can include this stub process in your inner simulation to provide those schemas from the outer simulation.

The process takes a single parameter, ports_schema, whose value is the process’s ports schema to be provided to the inner simulation.

Parameters:

parameters (dict | None) –

defaults: Dict[str, Any]
{'ports_schema': {}}
next_update(timestep, states)[source]
ports_schema()[source]
class ecoli.processes.engine_process._InnerComposer(config=None)[source]

Bases: Composer

Base class for composer classes.

Composers generate composites.

All composer classes must inherit from this class.

Parameters:

config (dict | None) – Dictionary of configuration options that can override the class defaults.

generate_processes(config)[source]
generate_topology(config)[source]
class ecoli.processes.engine_process._OuterComposer(config=None)[source]

Bases: Composer

Base class for composer classes.

Composers generate composites.

All composer classes must inherit from this class.

Parameters:

config (dict | None) – Dictionary of configuration options that can override the class defaults.

generate_processes(config)[source]
generate_topology(config)[source]
class ecoli.processes.engine_process._ProcA(parameters=None)[source]

Bases: Process

Parameters:

parameters (dict | None) –

next_update(timestep, states)[source]

Each timestep, port_a += port_c.

ports_schema()[source]
class ecoli.processes.engine_process._ProcB(parameters=None)[source]

Bases: Process

Parameters:

parameters (dict | None) –

next_update(timestep, states)[source]

Each timestep, port_b += 1.

ports_schema()[source]
class ecoli.processes.engine_process._ProcC(parameters=None)[source]

Bases: Process

Parameters:

parameters (dict | None) –

next_update(timestep, states)[source]

Each timestep, port_c += port_b.

ports_schema()[source]
ecoli.processes.engine_process._get_path_net_depth(path)[source]
ecoli.processes.engine_process._inverse_update(initial_state, final_state, store, updater_registry_reverse)[source]
ecoli.processes.engine_process.cap_tunneling_paths(topology, outer=())[source]