API Reference¶
-
exception
ubatch.ubatch.BadBatchOutputSize(input_size, output_size)¶ Raised when output size of handler differs from input size
- Parameters
input_size (
int) – Size of inputoutput_size (
int) – Size of output
-
exception
ubatch.ubatch.HandlerAlreadySet¶ Raised when trying to change handler on running uBatch
-
exception
ubatch.ubatch.HandlerNotSet¶ Raised when not handler is set in UBatch
-
class
ubatch.ubatch.UBatch(max_size, timeout)¶ Join multiple individual inputs into one batch of inputs.
- Parameters
max_size (
int) – Maximum size of inputs to pass to the handler.timeout (
float) – Maximum time (in seconds) to wait for inputs before starting to process them.
-
set_handler(handler)¶ Set function to handle inputs data
- Parameters
handler (
Callable[…,List[~S]]) – Any callable to handle input data and return output data- Return type
None
-
stop()¶ Stop thread processing data.
- Return type
None
-
ubatch(*args, **kwargs)¶ Add a new input to queue to being processed by handler in batches
Wait and returns output value from handler.
- Return type
~S