towhee.engine.operator_pool.OperatorPool¶
- class towhee.engine.operator_pool.OperatorPool(cache_path: Optional[str] = None)[source]¶
Bases:
object
OperatorPool manages Operator creation, acquisition, release, and garbage collection. Each TaskExecutor has one OperatorPool.
Methods
Instruct the OperatorPool to reserve and return the specified operator for use in the executor.
clear
Releases the specified operator and all associated resources back to the OperatorPool.
- acquire_op(hub_op_id: str, op_args: Dict[str, any], tag: str) Operator [source]¶
Instruct the OperatorPool to reserve and return the specified operator for use in the executor.
- Parameters:
hub_op_id – (str)
op_args – (Dict[str, any]) operator init parameters
- Returns:
- (towhee.operator.Operator)
The operator instance reserved for the caller.