Skip to content

Multi-worker supervisor inside a single invocation #68

Description

@splaice

Context

PR #58 / #60's supervised path is single-worker only — when `workers > 1` the run() function falls back to the unsupervised `ProcessPoolExecutor` path which has no hard timeout. For non-MPS workloads (embedding-only re-runs, future Docling parallelism, CPU-bound extractors) proper multi-worker supervision would unlock real parallelism.

Not urgent because MPS contention makes parallel marker workers strictly bad anyway (#64).

Proposal

Extend `_run_supervised_single_worker` into `_run_supervised_workers(n)`:

  • Spawn N `_subprocess_worker` children, each with its own UUID-based `claimed_by`.
  • Single supervisor loop polls `_find_stuck_extracting` per-worker and SIGKILLs only the offending child.
  • Respawn killed children individually.
  • Same process-group kill semantics for grandchild reaping.

`run()` dispatches to this when `workers > 1` AND `extract_timeout_s > 0`.

Acceptance criteria

  • Multi-worker supervised path exists.
  • N parallel children share work via SKIP LOCKED + claimed_by isolation.
  • Killing one worker leaves the others running.
  • Unit + integration tests for multi-worker kill scenarios.

Out of scope

This issue does NOT advocate using multiple MPS workers — see #64. The motivating use case is CPU-bound or non-MPS extractors.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4Low: someday/maybeenhancementNew feature or requestsupervisorSubprocess supervisor / worker lifecycle

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions