Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Interpretml Interpret Powerlift LocalMachine: Difference between revisions

From Leeroopedia
Auto-imported from implementations/Interpretml_Interpret_Powerlift_LocalMachine.md
 
Sync from local file
 
Line 120: Line 120:
== Related Pages ==
== Related Pages ==


* [[Interpretml_Interpret_Powerlift_Executor]] -- Abstract base class that LocalMachine extends
* [[Implementation:Interpretml_Interpret_Powerlift_Executor]] -- Abstract base class that LocalMachine extends
* [[Interpretml_Interpret_Powerlift_InsecureDocker]] -- Child class that runs trials in local Docker containers
* [[Implementation:Interpretml_Interpret_Powerlift_InsecureDocker]] -- Child class that runs trials in local Docker containers
* [[Interpretml_Interpret_Powerlift_RunTrials]] -- The trial runner function called by submit()
* [[Implementation:Interpretml_Interpret_Powerlift_RunTrials]] -- The trial runner function called by submit()
* [[Interpretml_Interpret_Powerlift_Schema]] -- Database schema models used by the Store
* [[Implementation:Interpretml_Interpret_Powerlift_Schema]] -- Database schema models used by the Store


[[Category:Implementations]]
[[Category:Implementations]]


[[Category:Implementations]]
[[Category:Implementations]]

Latest revision as of 10:42, 27 September 2026


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.Pool to run trials in parallel across available CPUs. The number of processes is configurable via n_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 the powerlift.run.__main__ module, passing experiment ID, runner ID, database URI, timeout, and error handling flags.
  • Error handling -- Supports raise_exception parameter to propagate exceptions. In debug mode, exceptions are always propagated. In pool mode, uses handle_err as the error callback.
  • Base for Docker executor -- Serves as the parent class for InsecureDocker, which overrides submit() 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

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