Implementation:Interpretml Interpret Powerlift LocalMachine
| Knowledge Sources | |
|---|---|
| Domains | Benchmarking, Execution |
| Last Updated | 2026-02-07 12:00 GMT |
Overview
Local machine executor that runs Powerlift benchmark trials directly on the host machine using multiprocessing pools for parallelism, with support for debug mode single-threaded execution.
Description
The LocalMachine class extends the Executor base class to run trial workloads on the local machine. It provides the simplest execution path for benchmarking without requiring any remote infrastructure.
Key characteristics:
- Multiprocessing parallelism -- Uses Python's
multiprocessing.Poolto run trials in parallel across available CPUs. The number of processes is configurable vian_cpus, defaulting to the system CPU count. - Debug mode -- When
debug_mode=True, the pool is disabled and trials execute sequentially in the main process, making it easy to attach debuggers and get stack traces. - Direct runner invocation -- Calls
run_trials()directly from thepowerlift.run.__main__module, passing experiment ID, runner ID, database URI, timeout, and error handling flags. - Error handling -- Supports
raise_exceptionparameter to propagate exceptions. In debug mode, exceptions are always propagated. In pool mode, useshandle_erras the error callback. - Base for Docker executor -- Serves as the parent class for
InsecureDocker, which overridessubmit()to run in containers instead.
Usage
Use this executor for local development, testing, and small-scale benchmarking. It is the default executor choice when no cloud infrastructure is needed. Enable debug_mode for step-by-step debugging of trial execution.
Code Reference
Source Location
- Repository: Interpretml_Interpret
- File:
python/powerlift/powerlift/executors/localmachine.py
Signature
class LocalMachine(Executor):
def __init__(
self,
store: Store,
n_cpus: Optional[int] = None,
debug_mode: bool = False,
wheel_filepaths: Optional[List[str]] = None,
raise_exception: bool = False,
): ...
def submit(self, experiment_id, timeout=None): ...
def join(self): ...
def cancel(self): ...
@property
def n_cpus(self): ...
@property
def store(self): ...
@property
def debug_mode(self): ...
@property
def wheel_filepaths(self): ...
Import
from powerlift.executors.localmachine import LocalMachine
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| store | Store | Yes | Store instance that houses trials and provides the database URI |
| n_cpus | int | No | Maximum number of CPUs to use (defaults to system CPU count) |
| debug_mode | bool | No | Restrict to single thread and raise exceptions (default: False) |
| wheel_filepaths | List[str] | No | Wheel files to install for trial execution |
| raise_exception | bool | No | Whether to raise exceptions on trial failure (default: False) |
Outputs
| Name | Type | Description |
|---|---|---|
| join() return | List | List of results from each runner process |
Usage Examples
from powerlift.bench.store import Store
from powerlift.executors.localmachine import LocalMachine
store = Store("sqlite:///powerlift.db")
# Standard parallel execution
executor = LocalMachine(store=store, n_cpus=4)
executor.submit(experiment_id=1, timeout=3600)
results = executor.join()
# Debug mode for step-through debugging
executor_debug = LocalMachine(store=store, debug_mode=True)
executor_debug.submit(experiment_id=1, timeout=3600)
Related Pages
- Implementation:Interpretml_Interpret_Powerlift_Executor -- Abstract base class that LocalMachine extends
- Implementation:Interpretml_Interpret_Powerlift_InsecureDocker -- Child class that runs trials in local Docker containers
- Implementation:Interpretml_Interpret_Powerlift_RunTrials -- The trial runner function called by submit()
- Implementation:Interpretml_Interpret_Powerlift_Schema -- Database schema models used by the Store