Files
annotations/Azaion.AI/remote_command.pyx
T
Alex Bezdieniezhnykh 82b3b526a7 rewrite to zmq push and pull patterns.
file load works, suite can start up
2025-01-23 14:37:13 +02:00

20 lines
631 B
Cython

import msgpack
cdef class RemoteCommand:
def __init__(self, CommandType command_type, str filename, bytes data):
self.command_type = command_type
self.filename = filename
self.data = data
def __str__(self):
command_type_names = {
1: "INFERENCE",
2: "LOAD",
}
return f'{command_type_names[self.command_type]}: {self.filename}'
@staticmethod
cdef from_msgpack(bytes data):
unpacked = msgpack.unpackb(data, strict_map_key=False)
return RemoteCommand(unpacked.get("CommandType"), unpacked.get("Filename"), unpacked.get("Data"))