libmuscle.mmsf_validator module

class libmuscle.mmsf_validator.MMSFValidator(port_manager: PortManager)[source]

Bases: object

The MMSF Validator checks whether Instances are following the Multiscale Modelling and Simulation Framework when sending and receiving messages.

In particular it checks that in order:

  1. reuse_instance() is called

  2. Messages are received on all F_INIT ports

  3. The following sub-items happen in order, 0 or more times:

    1. Messages are sent on all O_I ports

    2. Messages are received on all S ports

  4. Messages are sent on all O_F ports

If any message is sent or received out of order, a warning is logged to indicate that the instance is not following the MMSF pattern. In some cases (for example the time bridge in examples/python/interact_coupling.py) this is expected and the warnings can be disabled by setting the SKIP_MMSF_SEQUENCE_CHECKS flag.

Note

Checks on vector ports are not implemented. When the instance uses vector ports, the MMSF Validator will be disabled.

check_receive(port_name: str, slot: int | None) None[source]

Check that receiving on the provided port adheres to the MMSF.

check_send(port_name: str, slot: int | None) None[source]

Check that sending on the provided port adheres to the MMSF.

reuse_instance() None[source]

Check that a reuse_instance() adheres to the MMSF.

skip_f_init() None[source]

Call when resuming from an intermediate snapshot: F_INIT is skipped.