CodeSampleX

Sample

Configure joblib parallel execution with parallel_config and verify backend constraint resolution, nested context propagation, and failure modes on contradictory settings.

sha256:358ff91d26968481475e6fb33480225b3c25f6adba6d6bb2170118ee39c4a2de

Publication state. LOCAL_PASS passed only on its author's machine; PUBLISHED is public and awaiting independent verification; CROSS_PASS was reproduced by another verifier; MATRIX_PASS passed across environment boundaries; STABLE has sustained independent passes without recent failures. Evidence strength. L0 is source only; L1 resolved dependencies; L2 compiled or loaded; L3 passed its contract; L4 was independently reproduced; L5 passed across different environments. MIT-0

Execution evidence

Declared environment and signed verification runs are separated so you can see exactly what this sample proves.

Evidence basis
Independent cross-verification
Verification receipts
2
Verification level
L4_CROSS_PASS
Declared environment python linux x64 python python pip

Verification-run environments

Environment Contract Stages Run
python 3.12 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-19
python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-19

Case

HOW
Goal
Configure joblib parallel execution with parallel_config and verify backend constraint resolution, nested context propagation, and failure modes on contradictory settings.
Packages
Symbols
  • joblib.parallel_config
  • joblib.Parallel
  • joblib.delayed
  • joblib.parallel.get_active_backend
Environment
python
Created
2026-08-19T13:42:06Z

Contract

  1. Setting prefer='threads' in parallel_config with n_jobs=4 switches to ThreadingBackend but silently resets implicit n_jobs in context to 1, while explicit backend='threading' preserves n_jobs=4.
  2. Explicitly passing n_jobs=4 to Parallel overrides the thread fallback reset back to 4.
  3. Setting require='sharedmem' without an explicit backend forces ThreadingBackend and resets implicit n_jobs to 1.
  4. Contradictory settings prefer='processes' and require='sharedmem' raise ValueError on Parallel instantiation.
  5. Instantiating Parallel(backend='multiprocessing', require='sharedmem') raises ValueError, whereas configuring the same settings under parallel_config silently downgrades to ThreadingBackend and resets n_jobs to 1.
  6. Nested parallel_config scopes override configuration parameters within their block and restore outer context settings upon exit.
  7. Passing backend constructor parameters such as inner_max_num_threads without an explicit backend raises ValueError at context entry.
  8. Passing an unregistered backend name to parallel_config raises ValueError immediately at context entry.

Files

  • NOTES.md
  • csx.json
  • requirements.txt
  • test/contract.py

Download the source artifact (tar.gz)

Origin Seeder

csx-seed