PluginThreads
- class lib.infer.runner.PluginThreads(name: str)
Bases:
objectHandles the holding of threads that will run a plugin’s various subprocesses.
- Parameters:
name (str) – The name of the plugin that the threads are being created for
Attributes Summary
The thread names that have been registered within this group
The global FSThread error state object
Methods Summary
is_alive()Test if any thread is alive
join()Join all of the plugin's threads
Register an external error state object.
register_thread(name, target)Register a thread
start()Start the plugin's threads
Attributes Documentation
- enabled
The thread names that have been registered within this group
- error_state
The global FSThread error state object
Methods Documentation
- is_alive() bool
Test if any thread is alive
- Return type:
Trueif any thread is alive otherwise False
- join() None
Join all of the plugin’s threads
- Return type:
None
- register_external_error_state(state: ErrorState) None
Register an external error state object.
If we are not running any threads (specifically, file handler), the pipeline can hang the calling thread. The error state from the calling thread can be populated here. This can only be called if no threads have been registered
- Parameters:
state (ErrorState) – The ErrorState object to register
- Raises:
RuntimeError – If an ErrorState object is registered when this object already contains threads
- Return type:
None
- register_thread(name: str, target: Callable[[Literal['pre_process', 'process', 'post_process']], None]) None
Register a thread
- Parameters:
name (str) – The name of the plugin handler’s processor that is running in the thread
target (Callable[[Literal['pre_process', 'process', 'post_process']], None]) – The function to run within the thread
- Return type:
None
- start() None
Start the plugin’s threads
- Return type:
None
- property enabled: list[str]
The thread names that have been registered within this group
- property error_state: ErrorState
The global FSThread error state object
- is_alive() bool
Test if any thread is alive
- Return type:
Trueif any thread is alive otherwise False
- join() None
Join all of the plugin’s threads
- Return type:
None
- register_external_error_state(state: ErrorState) None
Register an external error state object.
If we are not running any threads (specifically, file handler), the pipeline can hang the calling thread. The error state from the calling thread can be populated here. This can only be called if no threads have been registered
- Parameters:
state (ErrorState) – The ErrorState object to register
- Raises:
RuntimeError – If an ErrorState object is registered when this object already contains threads
- Return type:
None
- register_thread(name: str, target: Callable[[Literal['pre_process', 'process', 'post_process']], None]) None
Register a thread
- Parameters:
name (str) – The name of the plugin handler’s processor that is running in the thread
target (Callable[[Literal['pre_process', 'process', 'post_process']], None]) – The function to run within the thread
- Return type:
None
- start() None
Start the plugin’s threads
- Return type:
None