Files
annotations/Azaion.AI/processor_command.pyx
T
Alex Bezdieniezhnykh fb11622c32 rewrite inference and file loading to cython
Step 1: can compile
2025-01-15 16:43:56 +02:00

24 lines
645 B
Cython

import msgpack
cdef enum CommandType:
INFERENCE = 1
LOAD = 2
cdef enum ProcessorType:
SOCKET = 1,
RABBIT = 2
cdef class FileCommand:
cdef str filename
def __init__(self, command_type: CommandType, processor_type: ProcessorType, str filename):
self.command_type = command_type
self.processor_type = processor_type
self.filename = filename
@staticmethod
cdef from_msgpack(bytes data, processor_type: ProcessorType):
unpacked = msgpack.unpackb(data, strict_map_key=False)
return FileCommand(unpacked.get("CommandType"), processor_type, unpacked.get("Filename")
)