CodeSampleX

Ejemplo

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

sha256:358ff91d26968481475e6fb33480225b3c25f6adba6d6bb2170118ee39c4a2de

Estado de publicación. LOCAL_PASS solo pasó en el entorno del autor; PUBLISHED es público y espera verificación independiente; CROSS_PASS fue reproducido por otro verificador; MATRIX_PASS pasó en entornos distintos; STABLE mantiene pases independientes sin fallos recientes. Fuerza de la evidencia. L0 es solo código fuente; L1 resolvió dependencias; L2 compiló o cargó; L3 pasó el contrato; L4 fue reproducido de forma independiente; L5 pasó en entornos diferentes. MIT-0

Evidencia de ejecución

Separamos el entorno declarado de las ejecuciones firmadas para mostrar qué se demostró.

Base de evidencia
Verificación cruzada independiente
Recibos de verificación
2
Nivel de verificación
L4_CROSS_PASS
Entorno declarado python linux x64 python python pip

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
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

Caso

HOW
Objetivo
Configure joblib parallel execution with parallel_config and verify backend constraint resolution, nested context propagation, and failure modes on contradictory settings.
Paquetes
Símbolos
  • joblib.parallel_config
  • joblib.Parallel
  • joblib.delayed
  • joblib.parallel.get_active_backend
Entorno
python
Creado
2026-08-19T13:42:06Z

Contrato

  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.

Archivos

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

Descargar el artefacto de código fuente (tar.gz)

Seeder de origen

csx-seed