pydistsim.tests.test_metrics.CustomAlgorithm

class CustomAlgorithm(*args, **kwargs)[source]

Bases: Flood

Methods

__init__

add_observers

alarm

apply_restrictions

Apply all applicable restrictions.

block_inbox

Block the inbox of a node, so that only messages that satisfy the filter can be processed.

check_algorithm_initialization

Check if the algorithm's current state matches the expected initial state.

check_algorithm_termination

Check if the algorithm's current state matches the expected termination state.

check_restrictions

Check if the restrictions are satisfied.

clear_observers

close

Close the inbox of the node for a specific neighbor.

default

default_DONE

Do nothing, for all inputs.

disable_alarm

Disable an alarm.

disable_all_node_alarms

Disable all alarms set for the node.

initializer

Method used to initialize the algorithm.

is_halted

Check if the distributed algorithm has come to an end or deadlock, i.e. there are no messages to pass and no alarms set.

is_initialized

notify_observers

open

Open the inbox of the node for a specific neighbor.

receiving

receiving_IDLE

reset

Reset the algorithm to its initial state.

send

Send content to destination, with header.

send_msg

Send a message to nodes listed in message's destination field.

set_alarm

Set an alarm for the node.

spontaneously

spontaneously_INITIATOR

step

unblock_inbox

Unblock the inbox of a node, so that all messages can be processed.

update_alarm_time

Update the time of an alarm by adding a time difference.

Attributes

INI

S_init

Tuple of statuses that nodes should have at the beginning of the algorithm.

S_term

Tuple of statuses that nodes should have at the end of the algorithm.

algorithm_restrictions

Tuple of restrictions that must be satisfied for the algorithm to run.

default_params

network

required_params

nwm

Node wrapper manager.

_alarms: list[Alarm]

List of alarms set for the nodes.

default_DONE(*args, **kwargs)

Do nothing, for all inputs.