libmuscle.manager.instance_registry module

exception libmuscle.manager.instance_registry.AlreadyRegistered[source]

Bases: RuntimeError

class libmuscle.manager.instance_registry.InstanceRegistry[source]

Bases: object

Keeps track of running instances.

The InstanceRegistry is a simple in-memory database that stores information about running instances of simulation components.

Construct an empty InstanceRegistry

add(name: ymmsl.identity.Reference, locations: List[str], ports: List[ymmsl.component.Port]) None[source]

Add an instance to the registry.

Parameters
  • name – Name of the instance.

  • locations – Network locations where it can be reached.

  • ports – List of ports of this instance.

Raises

ValueError – If an instance with this name has already been registered.

get_locations(name: ymmsl.identity.Reference) List[str][source]

Retrieves the locations of a registered instance.

Parameters

name – The name of the instance to get the location of.

Raises

KeyError – If no instance with this name was registered.

get_ports(name: ymmsl.identity.Reference) List[ymmsl.component.Port][source]

Retrieves the ports of a registered instance.

Parameters

name – The name of the instance whose ports to retrieve.

Raises

KeyError – If no instance with this name was registered.

remove(name: ymmsl.identity.Reference) None[source]

Remove an instance from the registry.

Parameters

name – Name of the instance to remove.

Raises

KeyError – If the instance does not exist.

wait() None[source]

Waits until all instances are deregistered.

This function blocks, and returns after each instance has been registered and deregistered again, signally the end of the simulation run.