FileHandler

class lib.infer.handler.FileHandler

Bases: ExtractHandler

A pseudo handler that passes through data when the pipeline is driven entirely by an alignments file (ie: no plugins are being loaded). This is effectively a No-op which allows the data to pass straight from input to output

Attributes Summary

batch_size

The batch size of the plugin

processors

File handler launches no threads

runner

The runner that runs this handler

Methods Summary

__call__([input_plugin, profile])

Build and start the plugin handler's runner.

init_model()

Load the model, compile it, if requested, and send a warmup batch through.

output_info()

Called after the final item is put to the out queue.

post_process(batch)

Not applicable for passthrough plugin.

pre_process(batch)

Not applicable for passthrough plugin.

process(batch)

Not applicable for passthrough plugin.

Attributes Documentation

batch_size

The batch size of the plugin

processors: tuple[Literal['pre_process', 'process', 'post_process'], ...] = ()

File handler launches no threads

runner

The runner that runs this handler

Methods Documentation

__call__(input_plugin: ExtractHandler | ExtractRunner | None = None, profile: bool = False) ExtractRunner

Build and start the plugin handler’s runner. Overridden to ensure that neither an input plugin or profile are set

Parameters:
  • input_plugin (ExtractHandler | ExtractRunner | None) – The input plugin handler or it’s runner that feeds this handler. None if data is to be fed through the handler runner’s put method (ie, the first handler in an extraction chain). Must be None for file handler

  • profile (bool) – True if the runner is to be profiled, indicating that threads will not be started. Must be False for file handler

Return type:

The extract plugin handler’s runner for this handler

init_model() None

Load the model, compile it, if requested, and send a warmup batch through. Called either from the main thread, if compiling, or from the inference thread if not.

Return type:

None

output_info() None

Called after the final item is put to the out queue. Override for plugin runner specific output

Return type:

None

post_process(batch: ExtractBatch) None

Not applicable for passthrough plugin.

Parameters:

batch (ExtractBatch)

Return type:

None

pre_process(batch: ExtractBatch) None

Not applicable for passthrough plugin.

Parameters:

batch (ExtractBatch)

Return type:

None

process(batch: ExtractBatch) None

Not applicable for passthrough plugin.

Parameters:

batch (ExtractBatch)

Return type:

None

class Plugin

Bases: object

Dummy plugin with required properties

__call__(input_plugin: ExtractHandler | ExtractRunner | None = None, profile: bool = False) ExtractRunner

Build and start the plugin handler’s runner. Overridden to ensure that neither an input plugin or profile are set

Parameters:
  • input_plugin (ExtractHandler | ExtractRunner | None) – The input plugin handler or it’s runner that feeds this handler. None if data is to be fed through the handler runner’s put method (ie, the first handler in an extraction chain). Must be None for file handler

  • profile (bool) – True if the runner is to be profiled, indicating that threads will not be started. Must be False for file handler

Return type:

The extract plugin handler’s runner for this handler

post_process(batch: ExtractBatch) None

Not applicable for passthrough plugin.

Parameters:

batch (ExtractBatch)

Return type:

None

pre_process(batch: ExtractBatch) None

Not applicable for passthrough plugin.

Parameters:

batch (ExtractBatch)

Return type:

None

process(batch: ExtractBatch) None

Not applicable for passthrough plugin.

Parameters:

batch (ExtractBatch)

Return type:

None

processors: tuple[Literal['pre_process', 'process', 'post_process'], ...] = ()

File handler launches no threads