Skip to main content

warmpool

A single-worker subprocess pool that can kill C extensions.

PyPI License Python


A "ProcessPool-like-executor" with hard-kill timeouts and import warming. The basic problem is that if you freeze up deep in a C-extension Python timeout-handling stuff doesn't work. warmpool runs functions in a spawned subprocess, and if they exceed their timeout it SIGTERM+SIGKILL the process and all children if the C extension has spawned anything.

  • It calls a "warming function" in each new process, so you can have it keep a process warmed with import scipy, numpy, etc which can easily be 2+ seconds.
  • The timeouts actually work regardless of what happens in the function.
  • It has an option to keep a spare process warm in the background so it can rotate cleanly without eating an import period.
  • It sends logs back to the parent through a pipe.
import time
from warmpool import WarmPool

def warm_imports():
    import numpy
    import scipy.linalg

def eigh_huge(n=5000):
    """Stuck in LAPACK C code — only SIGKILL works."""
    import numpy as np
    from scipy import linalg
    a = np.random.rand(n, n)
    a = a + a.T
    return linalg.eigh(a)

def add(a=0, b=0):
    return a + b

pool = WarmPool(warming=warm_imports)

# numpy+scipy are already imported — no 2s wait
start = time.perf_counter()
try:
    pool.run(eigh_huge, timeout=0.5, n=5000)
except TimeoutError:
    print(f"killed after {time.perf_counter() - start:.2f}s")

# pool recovered via spare
result = pool.run(add, timeout=5.0, a=2, b=3)
print(f"recovered: add(2, 3) = {result}")
pool.shutdown()
killed after 0.53s
recovered: add(2, 3) = 5

Metadata

Release files for warmpool 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for warmpool 0.1.2
File Size Uploaded
warmpool-0.1.2.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for warmpool 0.1.2
File Interpreter ABI Platform
warmpool-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / warmpool-0.1.2.tar.gz

Download URL warmpool-0.1.2.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
890e6a77b6ea6a4682021a1d81e7c7f27dff70c5839c7393512bd74f00a9bf04
BLAKE2b-256 checksum
How to use checksums
4444b44d6282ac9144eeec54eb46619f86d4fa35ff035f4fc85ec1cb86027e06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 12, 2026.

Transparency log

Release files / warmpool-0.1.2-py3-none-any.whl

Download URL warmpool-0.1.2-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b2bf2ee25a76414532e619ef2c0668e1e0d6feb3c2849b984d053b8e7902580
BLAKE2b-256 checksum
How to use checksums
0b861e09c6db132355608d967dcfa42db1bfade3de378af3b3f98bfe725df1af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page