skyllh.cluster package#
Submodules#
skyllh.cluster.commands module#
- class skyllh.cluster.commands.Command#
Bases:
objectBase class for a command. A command has a command string plus optional additional data.
- as_message()#
- send(sock)#
- is_same_as(cmd)#
- __annotations_cache__ = {}#
- __firstlineno__ = 14#
- __static_attributes__ = ()#
- class skyllh.cluster.commands.ACK#
Bases:
Command- __annotations_cache__ = {}#
- __firstlineno__ = 34#
- __static_attributes__ = ()#
- class skyllh.cluster.commands.MSG(msg)#
Bases:
Command- __annotations_cache__ = {}#
- __firstlineno__ = 41#
- __static_attributes__ = ('msg',)#
- class skyllh.cluster.commands.ShutdownCN#
Bases:
Command- __annotations_cache__ = {}#
- __firstlineno__ = 50#
- __static_attributes__ = ()#
- class skyllh.cluster.commands.RegisterCN(cn_start_time, cn_live_time)#
Bases:
CommandCreates a register compute node command.
- Parameters:
cn_start_time (int) – The compute node’s start time as unix time stamp.
cn_live_time (int) – The compute node’s live time. After that time the CN should be considered dead.
- __annotations_cache__ = {}#
- __firstlineno__ = 57#
- __static_attributes__ = ('_cn_live_time', '_cn_start_time', 'cn_live_time', 'cn_start_time')#
- property cn_start_time#
The CN’s start time as unix time stamp.
- property cn_live_time#
The CN’s live time in seconds.
- skyllh.cluster.commands.receive_command_from_socket(sock, blocksize=2048)#
Receives a command from the given socket.
skyllh.cluster.compute_node module#
- class skyllh.cluster.compute_node.ComputeNode(live_time, master_addr, master_port)#
Bases:
objectThe ComputeNode class provides an entity for stand-alone program running on a dedicated compute node host.
- __del__()#
- property live_time#
The time in seconds this ComputeNode instance should be listening for requests.
- property master_addr#
The address of the SkyLLH master program.
- __annotations_cache__ = {}#
- __firstlineno__ = 19#
- __static_attributes__ = ('_live_time', '_master_addr', '_master_port', '_start_time', 'live_time', 'master_addr', 'master_port', 'sock')#
- property master_port#
The port number of the SkyLLH master program.
- handle_requests()#
skyllh.cluster.master_node module#
- class skyllh.cluster.master_node.CNRegistryEntry(sock, addr, port, cn_start_time, cn_live_time)#
Bases:
objectThis class provides an registry entry for a compute node. It holds the socket to the compute node.
- __del__()#
- property key#
(read-only) The CN’s identification key.
- send_command(cmd)#
- __annotations_cache__ = {}#
- __firstlineno__ = 16#
- __static_attributes__ = ('addr', 'cn_live_time', 'cn_start_time', 'port', 'sock')#
- class skyllh.cluster.master_node.MasterNode#
Bases:
objectThe MasterNode class provides an entity to run the SkyLLH program as a master node, where compute nodes can register to, so the master node can distribute work to the compute nodes. The work distribution is handled through the MasterNode instance.
- property cn_registry#
The dictionary with the registered compute nodes.
- clear_cn_registry()#
- register_compute_nodes(n_cn=10, master_port=9999, blocksize=2048)#
- __annotations_cache__ = {}#
- __firstlineno__ = 45#
- __static_attributes__ = ('_cn_registry', 'cn_registry')#
- send_request(msg)#
- shutdown_compute_nodes()#
Sends a stop command to all compute nodes.
skyllh.cluster.srvclt module#
- class skyllh.cluster.srvclt.Message(msg)#
Bases:
objectCreates a new Message instance.
- Parameters:
msg (str | bytes) – The message string of this Message instance.
- static receive(sock, blocksize=2048, as_bytes=False)#
Receives a message from the given socket.
- Parameters:
blocksize (int) – The size in bytes of the block that should be read from the socket at once.
as_bytes (bool) – If set to
Truethe Message instance will contain a bytes message, otherwise it is converted to a str.
- Returns:
m (Message) – The Message instance created with the message read from the socket.
- property msg#
The message string. This is either a bytes instance or a str instance.
- property length#
The length of the message in bytes.
- as_socket_msg()#
Converts this message to a bytes instance that can be send through a socket. The first two bytes hold the length of the message.
- send(sock)#
- __annotations_cache__ = {}#
- __firstlineno__ = 10#
- __static_attributes__ = ('_msg', 'msg')#
- skyllh.cluster.srvclt.send_to_socket(sock, msg)#
- skyllh.cluster.srvclt.read_from_socket(sock, size, blocksize=2048)#
Reads
sizebytes from the socketsock.
- skyllh.cluster.srvclt.receive_object_from_socket(sock, blocksize=2048)#
Receives a pickled Python object from the given socket.
- Parameters:
sock (socket)