ExecutorBuilt incomes with cpbenchy
cpbenchy run instances/ -s ortools -t 60 --executor inline- Version
- cpbenchy 0.1.0.dev0
- Last updated
- 6 Oct 2026 · 1 commit
- Authors
- ThomSerg
- Tags
- executordebugging
What it does
Runs the worker inside your own process, one run at a time, without limits. Breakpoints in worker plugins work, so it is the way to debug a plugin step by step.
Use it
import cpbenchy
cpbenchy.run("instance.opb", solvers=["ortools"], time_limit=60, executor="inline")cpbenchy run instance.opb -s ortools -t 60 --executor inlineImplementation
The InlineExecutor in src/cpbenchy/executors.py, lines 228–255 of 305, as of this version of the docs.
class InlineExecutor(Executor):
"""Runs the worker in this process, one run at a time, without limits: for debugging (breakpoints work)
and fast tests."""
name = "inline"
def start(self, job: WorkerJob) -> "Future[Measurement]":
future: Future[Measurement] = Future()
future.set_result(self.execute(job))
return future
def execute(self, job: WorkerJob) -> Measurement:
from cpbenchy.worker.runtime import main
start, cpu_start = time.monotonic(), time.process_time()
exitcode = main([str(job.job_file)])
return Measurement(
walltime_s=time.monotonic() - start,
cputime_s=time.process_time() - cpu_start,
memory_mib=None,
termination=None,
exitcode=exitcode,
executor=self.name,
reliable=False,
)
# --- plugin: choosing the executor ---