loqs.core.executors¶
Structural executor protocols shared by shot-level and program-level parallelism.
Two distinct executor shapes exist in this codebase, matching two different dispatch mechanisms:
SubmitExecutor: anything exposing aconcurrent.futures-style.submit()method returning aFuture. Satisfied byloky.get_reusable_executor()andmpi4py.futures.MPIPoolExecutor(both realconcurrent.futures.Executorsubclasses) without a hard dependency on either package. Used for shot-level parallelism (run()'sshot_executorparameter) and, vialoqs.tools.paralleltools.ParallelStrategy, for program-level parallelism dispatched one.submit()call per chunk.MapArrayExecutor: anything exposing asubmitit-style.map_array()bulk-submission method. Satisfied bysubmitit.Executor, which submits a singlesbatchcall covering an entire batch of chunks rather than one job per chunk. Used exclusively for program-level parallelism vialoqs.tools.paralleltools.ParallelStrategy; never for shot-level parallelism. Note that asubmitit.Executoractually satisfies both protocols (it has a.submit()method too), so code that cares aboutmap_array's bulk-submission efficiency must check forMapArrayExecutorfirst.
Both are runtime_checkable, so isinstance(x, SubmitExecutor)/
isinstance(x, MapArrayExecutor) work directly for dispatch-mechanism
detection, without hardcoding which concrete package produced x.