libmuscle.manager.deadlock_detector module
- class libmuscle.manager.deadlock_detector.DeadlockDetector[source]
Bases:
objectThe DeadlockDetector attempts to detect when multiple instances are stuck waiting for each other.
This class is responsible for handling WAITING_FOR_RECEIVE, IS_DEADLOCKED and WAITING_FOR_RECEIVE_DONE MMP messages, which are submitted by the MMPServer.
When a deadlock is detected, the cycle of instances that is waiting for each other is logged with FATAL severity.
- is_deadlocked(instance_id: str) bool[source]
Check if the provided instance is part of a detected deadlock.
This method can be called from any thread.
- waiting_for_receive(instance_id: str, peer_instance_id: str, port_name: str, slot: int | None) None[source]
Process a WAITING_FOR_RECEIVE message from an instance.
This method can be called from any thread.
- Parameters:
instance_id – ID of instance that is waiting to receive a message.
peer_instance_id – ID of the peer that the instance is waiting for.
port_name – Name of the input port.
slot – Optional slot number of the input port.
- waiting_for_receive_done(instance_id: str, peer_instance_id: str, port_name: str, slot: int | None) None[source]
Process a WAITING_FOR_RECEIVE_DONE message from an instance.
This method can be called from any thread.
- Parameters:
instance_id – ID of instance that is waiting to receive a message.
peer_instance_id – ID of the peer that the instance is waiting for.
port_name – Name of the input port.
slot – Optional slot number of the input port.