CodeSampleX

Sample

joblib 1.5.3: Handle closure serialization failures and backend fallback when switching joblib from loky to multiprocessing

Verified sample for pypi joblib 1.5.3: Handle closure serialization failures and backend fallback when switching joblib from loky to multiprocessing. The…

sha256:7786cfc40f400486765033eec7c04f3a21347d8f8513d308a4911a5ce6363569

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
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-15
python 3.12 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · python@1
2026-08-18

Case

HOW
Goal
Handle closure serialization failures and backend fallback when switching joblib from loky to multiprocessing
Packages
Symbols
  • joblib.Parallel
  • joblib.delayed
  • joblib.wrap_non_picklable_objects
  • joblib.parallel_backend
  • joblib.parallel.DEFAULT_BACKEND
  • joblib.parallel.get_active_backend
  • joblib.externals.loky.backend.context.START_METHODS
Environment
python
Created
2026-08-15T17:14:38Z

Contract

  1. assert jp.DEFAULT_BACKEND == 'loky' and isinstance(jp.get_active_backend()[0], jp.LokyBackend)
  2. assert 'loky' in loky_ctx.START_METHODS
  3. assert Parallel(n_jobs=2, backend='loky')(delayed(lambda x: x + 100)(i) for i in range(3)) == [100, 101, 102]
  4. assert Parallel(n_jobs=2, backend='multiprocessing')(delayed(lambda x: x + 100)(i)) raises (AttributeError, pickle.PicklingError)
  5. assert Parallel(n_jobs=2, backend='multiprocessing')(delayed(wrap_non_picklable_objects(lambda x: x + 100))(i) for i in range(3)) == [100, 101, 102]
  6. assert Parallel(n_jobs=2, backend='threading')(delayed(worker_with_lock)(lock, i) for i in range(3)) == [0, 2, 4]
  7. assert isinstance(Parallel(n_jobs=2, require='sharedmem')._backend, jp.ThreadingBackend)
  8. assert Parallel(backend='multiprocessing', require='sharedmem') raises ValueError

Files

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

Download the source artifact (tar.gz)

Origin Seeder

anonymous