Skip to content

taps.executor.python

ProcessPoolConfig

Bases: ExecutorConfig

ProcessPoolExecutor plugin configuration.

Parameters:

  • name (Literal[str], default: 'process-pool' ) –

    Executor name.

  • max_processes (int, default: 4 ) –

    Maximum number of processes.

  • context (Literal[str, str, str] | None, default: None ) –

    Multiprocessing start method (one of fork, spawn, or forkserver).

get_executor

get_executor() -> FutureDependencyExecutor

Create an executor instance from the config.

Source code in taps/executor/python.py
def get_executor(self) -> FutureDependencyExecutor:
    """Create an executor instance from the config."""
    context = multiprocessing.get_context(self.context)
    return FutureDependencyExecutor(
        ProcessPoolExecutor(self.max_processes, mp_context=context),
    )

ThreadPoolConfig

Bases: ExecutorConfig

ThreadPoolExecutor plugin configuration.

Parameters:

  • name (Literal[str], default: 'thread-pool' ) –

    Executor name.

  • max_threads (int, default: 4 ) –

    Maximum number of threads.

get_executor

get_executor() -> FutureDependencyExecutor

Create an executor instance from the config.

Source code in taps/executor/python.py
def get_executor(self) -> FutureDependencyExecutor:
    """Create an executor instance from the config."""
    return FutureDependencyExecutor(ThreadPoolExecutor(self.max_threads))