Skip to content

MILAB-7089: Fix the block on a backend without Docker - #7

Merged
kevindetry-milaboratories merged 3 commits into
mainfrom
MILAB-7089-builtin-backend
Oct 2, 2026
Merged

kevindetry-milaboratories merged 3 commits into
mainfrom
MILAB-7089-builtin-backend

Conversation

@kevindetry-milaboratories

@kevindetry-milaboratories kevindetry-milaboratories commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The block fails on a backend without Docker, such as the desktop built-in backend (MILAB-7089):

ERROR: Could not find a version that satisfies the requirement llvmlite==0.48.0 (from versions: 0.44.0, 0.47.0)

Without Docker, the backend installs requirements.txt offline: pip install --no-index --find-links {runenv}/packages/. The block used the base 3.12.10 run environment, which does not have the pinned llvmlite, numba and numpy versions. Docker mode installs from PyPI, so it did not show the mismatch.

Change

  • software/package.json: use runenv-python-3:3.12.10-pgen. MILAB-7089: Pin pgen runenv to the Generation Probability set runenv-python-3#110 updated that variant to the block pins (pgen 0.3.0). The catalog pin goes from 1.8.2 to 1.14.1, which maps 3.12.10-pgen to 0.3.0. No dependency is downgraded.
  • software/src/main.py: keep forkserver workers as the default, and fall back to spawn only when forkserver cannot start. pool_context() gets the forkserver context and starts the server at once with forkserver.ensure_running(). It falls back on:
    • ValueError: Windows has no forkserver.
    • OSError: the forkserver socket is created under TMPDIR, which is <main-root>/work/workdirs/<id>/.pl/tmp. With the default ~/.platforma/backend root this is about 100 characters, and the limit is 107 (Linux) or 103 (macOS). A longer user name or a custom root gives AF_UNIX path too long.
    • The fallback prints forkserver unavailable (<error>), using spawn to stderr. The model reads only the progress: and skipped: lines, so the progress output does not change.
    • The fallback uses spawn, not the platform default, because the Linux default is fork, which is not safe with running polars threads.
  • workflow/src/pgen-process.test.ts: a regression test. It renders the real pgen-process template on four CDR3s and checks each Pgen and -log10 Pgen value. CI builds the software as binary only, so the test runs the same offline pip install as a backend without Docker.
  • pnpm upgrade-sdk: block-tools 2.16.6, tengo-builder 4.1.6, test 1.84.6, ui-vue 1.84.5.

macOS Intel stays unsupported: numba 0.66 and llvmlite 0.48 have no cp312 wheels for it.

Tests

On a local backend 4.4.5 with Docker off, with only published packages (npm and bin.pl-open.science):

  • The real pgen-process template ran on a 4-row input (TRB, TRB, IGH, TRA).
  • The offline pip install --no-index from runenv-python-3.12.10-pgen/main/0.3.0-linux-x64 passed. The venv has the 7 pinned versions.
  • main.py ran without Docker. With a short main root (TMPDIR 57 characters) it used forkserver. With a deep main root (TMPDIR 200 characters) it printed the fallback line and used spawn. Both runs gave the same pgen values.
  • All 4 rows got a non-null pgen.
  • Root pnpm test passed (15/15 tasks). The new test takes about 76 s cold. It fails with the llvmlite==0.48.0 error when the base run environment is restored, and it fails when one expected value changes by 1.3e-6 relative. pnpm check passed.
  • Before the fix, the same setup with the base run environment gave the ticket's llvmlite==0.48.0 error. With a deep TMPDIR, the forkserver code gave AF_UNIX path too long. The new code gives the same results as before.

Not run on Windows or macOS. The pgen run environment built and passed its import checks on all four platforms in the runenv CI.

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no outstanding finding or new actionable defect was established.

Summary

The PR selects the pgen Python environment for Docker-free installation, restores forkserver workers with a spawn fallback, and adds an end-to-end scoring regression test.

  • Run environment: The Python package set available to the backend’s offline installer; the selected variant changes to 3.12.10-pgen.
  • Worker context: The multiprocessing method used for scoring; forkserver is preferred, with spawn used when startup is unavailable.
  • PColumn: A typed workflow data column; the new test constructs CDR3 and chain columns and checks their resulting scores.
  • Pgen: Generation probability for a sequence; the test checks Pgen and its negative base-10 logarithm for four clonotypes.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[CDR3 and chain columns] --> B[pgen-process template]
  B --> C[Offline Python run environment]
  C --> D{Forkserver starts?}
  D -->|Yes| E[Forkserver workers]
  D -->|No| F[Spawn workers]
  E --> G[Pgen and -log10 Pgen results]
  F --> G
  G --> H[Regression test assertions]
Loading

Reviews (2) · Last reviewed commit: "Test the Python scorer on the backend"

A backend without Docker installs Python packages offline from the run
environment. The base `3.12.10` run environment does not have the
pinned `llvmlite`, `numba` and `numpy` versions, so the install
failed.

- Use the `3.12.10-pgen` run environment. Catalogue `1.14.1` maps it
  to pgen `0.3.0`, which bundles the block pins.
- Start worker processes with `spawn`. Windows has no `forkserver`.
  On Linux and macOS, the `forkserver` socket path in a deep work
  directory can be longer than the system limit.
- Update the SDK with `pnpm upgrade-sdk`.
Comment thread software/package.json
`spawn` for every platform slows down worker start on the cluster.
Use `forkserver` as before, and start it at once with
`forkserver.ensure_running()`. Fall back to `spawn` only when it
cannot start:

- Windows has no `forkserver` (`ValueError`).
- On Linux and macOS, a deep work directory makes the socket path
  longer than the system limit (`OSError: AF_UNIX path too long`).
Render the real `pgen-process` template on four CDR3s and check the
Pgen and -log10 Pgen values. The test runs the offline `pip install`
from the run environment, as a backend without Docker does. It fails
when the run environment does not have the pinned wheels.
@kevindetry-milaboratories

Copy link
Copy Markdown
Collaborator Author

@greptileai

@kevindetry-milaboratories
kevindetry-milaboratories merged commit 2360a1b into main Oct 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants