Status Enums¶
melissa.server.simulation.SimulationDataStatus¶
melissa.server.simulation.SimulationStatus¶
Simulation Data types¶
melissa.server.simulation.SimulationData¶
Stores a combined representation of data related to a specific simulation instance.
Attributes¶
- simulation_id (
int): The id of the simulation. - time_step (
int): The time step for the simulation. - payload (
dict[str, conduit.Node | np.ndarray]): Dictionary mapping node names to their corresponding raw user-definedconduit.Nodeornp.ndarray. - parameters (
list): The list of parameter arrays for the simulation.
__repr__()
¶
Returns a string representation of the SimulationData object.
__getitem__(node_name)
¶
Access a raw user node directly from the storage map via its identifier.
__getstate__()
¶
Custom serialization state mapping for pickle.
__setstate__(state)
¶
Custom deserialization reconstruction hook.
melissa.server.simulation.PartialSimulationData¶
Stores incoming message segments for a specific simulation partition on the socket, isolating Melissa metadata from the raw user data node.
Attributes¶
- time_step (
int): The time step for the simulation. - simulation_id (
int): The id of the simulation. - client_rank (
int): The rank of the client submitting the data. - node_name (
str): The name/identifier of the node to which the data belongs. - payload (
conduit.Node | np.ndarray): The raw user-provided data payload layout. - persistent_client_id (
int): A persistent client id to under which this simulation will execute. Default is -1 means no persistent client assigned.
is_payload_empty()
¶
Ensures whether the payload contents are empty or not.
from_msg(msg, using_conduit_protocol=False)
classmethod
¶
Class method to extract the public message wrapper using decode_conduit_node and separate Melissa's tracking headers from the application-level data.
Parameters¶
- msg (
bytes): The serialized message in bytes format to be deserialized. - **using_conduit_protocol (
bool): Enable decoding with conduit parsing.
Returns¶
PartialSimulationData: An instance mapping metadata parameters alongside the raw payload.
__repr__()
¶
Returns a string representation of the PartialSimulationData object.
__getstate__()
¶
Custom serialization state mapping for pickle.
__setstate__(state)
¶
Custom deserialization reconstruction hook.
Main Classes¶
melissa.server.simulation.Simulation¶
Represents a single simulation with associated metadata.
Each object corresponds to a unique simulation or client and contains information necessary for tracking the simulation's state, parameters, and fault tolerance.
Attributes¶
- id_ (
int): The unique identifier for the simulation. - script_path (
str): Path of the simulation script (to be generated). - connected (
bool): If the simulation has established a connection with the server. - nb_time_steps (
int): The total number of time steps for the simulation. - node_names (
list[str]): A list of nodes that will be sent. - parameters (
list[Any]): A list of parameters used in the simulation. - persistent_client_id (
int): A persistent client id to under which this simulation will execute. Default is -1 means no persistent client assigned.
init_structures(client_rank, time_steps_known=True)
¶
Initializes data structures to track received simulation data for a given client rank.
Parameters¶
- client_rank (
int): The rank of the client whose data is being tracked. - time_steps_known (
bool, optional): if the total number of time steps is known in advance. Default isTrue.
init_data_storage(client_rank, time_step)
¶
Prepares storage for tracking node-level data for a specific time step of a client rank.
Parameters¶
- client_rank (
int): The rank of the client whose data is being tracked. - time_step (
int): The time step for which data storage is initialized.
time_step_expansion(client_rank, time_step)
¶
Dynamically expands the received_time_steps matrix for a client rank if the
time step exceeds current capacity.
Parameters¶
- client_rank (
int): The rank of the client whose matrix needs expansion. - time_step (
int): The time step that triggered the need for expansion.
update(client_rank, time_step, node_name, data)
¶
Updates the data associated with a specific node and time step for a client
rank. Also, in case of persistent_client_mode set, it updates the
persistent_client_id associated with the simulation which is required for
synchronicity of metadata across all the ranks.
Parameters¶
- client_rank (
int): The rank of the client whose data is being updated. - time_step (
int): The time step associated with the data. - node_name (
str): The specific node being updated. - data (
int | PartialSimulationData | None): The new data to store for the node.
get_data(client_rank, time_step)
¶
Retrieves the data for all nodes associated with a specific time step of a client rank.
Parameters¶
- client_rank (
int): The rank of the client whose data is being retrieved. - time_step (
int): The time step for which data is being fetched.
Returns¶
dict[str, int | PartialSimulationData | None]: A dictionary containing node_name names as keys and their corresponding data as values.
clear_data(client_rank, time_step)
¶
Clears the data for all nodes associated with a specific time step of a client rank. Useful when the complete data is given to the server for post- processing and no longer needs to be in this object. This is to avoid duplications in checkpointing.
Parameters¶
- client_rank (
int): The rank of the client whose data is being cleaned. - time_step (
int): The time step for which data is being cleaned.
has_already_received(client_rank, time_step, node_name)
¶
Checks if the given time step has already been received for the specified client and node, helping to avoid duplication of data.
Parameters¶
- client_rank (
int): The rank of the client whose data is being retrieved. - time_step (
int): The time step for which the data is being checked. - node_name (
str): The node associated with the data being checked.
Returns¶
bool: if the data has already been received.
is_complete(time_step)
¶
mark_as_received(client_rank, time_step, node_name)
¶
Marks the given time step as received for the specified node.
Parameters¶
- client_rank (
int): The rank of the client sending the data. - time_step (
int): The time step for which the data is received. - node_name (
str): The node_name associated with the data being marked as received.
has_finished(force=False)
¶
Checks whether all time steps for the simulation have been received, or forcefully marks as finished, if requested.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if all time steps have been received or force is True. |