rampgate-docker
Docker integration for rampgate, an admission scheduler for jobs that ramp up their memory. It runs rampgate's Start and Stop actions as containers, turns container exits into the outcomes the scheduler learns from (OOM, preempted, failed), and attributes process usage to jobs.
Install
pip install rampgate-docker
Requires access to a Docker daemon. Depends on rampgate and the docker SDK. The Docker socket is root-equivalent: whatever can reach it controls the host.
Usage
With an engine, a clock and an NVML probe from rampgate-nvml:
from rampgate import JobSample
from rampgate_docker import ContainerSpec, ContainerUsageMapper, DockerEventWatcher, DockerExecutor
from rampgate_nvml import pid_to_container_id
executor = DockerExecutor(lambda job, start: ContainerSpec("my-trainer:1", gpus="all"))
watcher = DockerEventWatcher(executor.client, clock, stop_reason=executor.stop_reason)
mapper = ContainerUsageMapper(executor.client, pid_to_container_id)
watcher.start()
while True:
now = clock()
for event in watcher.drain(): # JobStarted / JobExited
engine.apply(event)
observed, processes = probe.sample(now)
jobs = mapper.map(processes, now)
for dev in observed: # one atomic sample per device
engine.observe_sample(dev.device_id, now, dev.used_total, {
o.job_id: JobSample(o.attempt, o.usage) for o in jobs if o.device_id == dev.device_id
})
decision = engine.tick(now)
executor.apply(decision.actions, {j: rt.job for j, rt in engine.state.jobs.items()})
What each part does
DockerExecutor:Startremoves containers of older attempts of the job, then creates and starts a container labelledrampgate.job_id/rampgate.attempt, withRAMPGATE_JOB_ID,RAMPGATE_ATTEMPTandRAMPGATE_RESUMEin its environment.Stoprunscontainer.stop(timeout=grace_s)on a worker thread.classify_exit:OOMKilled, an OOM message in the log tail (CUDA out of memory,torch.OutOfMemoryError, …; configurable), or 137 under memory pressure →OOM; 0 →SUCCESS; 143/137 after a requested stop →PREEMPTED/CANCELLED; anything else →FAILURE.DockerEventWatcher: follows Docker's event stream on a thread;drain()hands the events to the Engine's thread.ContainerUsageMapper: probe process samples →JobObservedper job, attempt and device. Usage outside managed containers is left to rampgate's foreign-usage accounting.
What your training script must do
- Exit 143 when it stops on SIGTERM, after saving a checkpoint. Exit 0 means the job finished.
- Resume when
RAMPGATE_RESUME=1. - Let the OOM message reach its log. A GPU OOM sets no
OOMKilledflag, soclassify_exitrecognises it only from that message.
Demonstrated on one laptop GPU with synthetic memory-hog containers, not with a real framework's caching allocator.
Links
Documentation · rampgate core · Source · Changelog
Apache-2.0.
Metadata
Release files for rampgate-docker 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rampgate_docker-0.2.0.tar.gz | 18.1 kB | With provenance | Details for rampgate_docker-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rampgate_docker-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for rampgate_docker-0.2.0-py3-none-any.whl |
Total release size: 33.8 kB
Release files / rampgate_docker-0.2.0.tar.gz
| Download URL | rampgate_docker-0.2.0.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27e2d4e55c99025213e519058dcc06e4cc3b9473fecf991e51dc16584b028bbb
|
|
BLAKE2b-256 checksum How to use checksums |
9a432f86b2b31bf069f5a9855ba0cf700cd686d0e91627f0aa0a10488d1e390a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 21, 2026.
Transparency logRelease files / rampgate_docker-0.2.0-py3-none-any.whl
| Download URL | rampgate_docker-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e82e2070ddd91d78ae536b27fcd9c078d54aceca8a376ae1e0a2c65158a46881
|
|
BLAKE2b-256 checksum How to use checksums |
c133b8d758f28d31554fb7d1d7307c7c90d04bf24f60c1c9d9b10e186ed377ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 21, 2026.
Transparency logSecurity for rampgate-docker 0.2.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for rampgate_docker-0.2.0.tar.gz
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 Nov 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.