Skip to main content

Async and sync client + CLI for the gpu-lock service.

Reason this release was yanked:

incomplete release — use 0.2.1

Project description

gpu-lock-client

Python client + CLI for the gpu-lock service — a FIFO priority mutex that coordinates shared GPU access between processes and Docker containers.

pip install gpu-lock-client

Quick use — CLI

export GPU_LOCK_URL=http://192.168.10.13:8090

# Acquire GPU 0, run a command, release on exit (sets CUDA_VISIBLE_DEVICES).
gpu-lock run --gpu 0 -- python train.py

# Let the server pick the least-busy GPU.
gpu-lock run --gpu auto -- bash

# Interactive priorities run ahead of the normal queue.
gpu-lock run --gpu auto --priority high -- python infer.py

# Low-priority batch work yields to everyone else.
gpu-lock run --gpu 0 --priority low -- python nightly_job.py

# Inspection
gpu-lock status
gpu-lock queue --gpu 0

Quick use — Python

from gpu_lock_client import gpu_lock, gpu_lock_sync, Priority

# Async
async with gpu_lock("my-service", gpu=0, ttl=300, priority=Priority.HIGH) as lease:
    if lease:
        os.environ["CUDA_VISIBLE_DEVICES"] = str(lease.gpu)
    ...

# Sync
with gpu_lock_sync("my-service", gpu="auto", ttl=300) as lease:
    ...

The context manager automatically heart-beats the lease in the background, so long-running jobs don't need to pick a huge TTL.

Passthrough mode

If GPU_LOCK_URL is empty or unset, every client call is a no-op: functions return None, context managers yield None, the CLI's run just execs the command. This lets the same code run on single-GPU dev machines without a gpu-lock service.

Auth

Set GPU_LOCK_TOKEN — the client sends it as Authorization: Bearer.

See the project README for the full protocol, server setup, and priority semantics.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpu_lock_client-0.2.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gpu_lock_client-0.2.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file gpu_lock_client-0.2.0.tar.gz.

File metadata

  • Download URL: gpu_lock_client-0.2.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gpu_lock_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6b5db66328a952edc148feee84997b9c4d22a00acd0d4142a52573cd0a1dfbd6
MD5 979cc01596c4c830a039b6450e57b2cb
BLAKE2b-256 f0790c0a387096b155aade9469acfec25c21a418d4b9f1cfa61942ecd0f0e20f

See more details on using hashes here.

Provenance

The following attestation bundles were made for gpu_lock_client-0.2.0.tar.gz:

Publisher: publish.yml on ildar-idrisov/gpu-lock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gpu_lock_client-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: gpu_lock_client-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gpu_lock_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 729464e03263075d379cf9ec1f3b9bbfcae4a57da14312d8c9a1fcfe37875eba
MD5 eff8cd9dc8c501961faecc7e1a6166f6
BLAKE2b-256 d8b31a0522e717ea6d9276eb50c230c070c7558e571f298e93faddccb42779c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for gpu_lock_client-0.2.0-py3-none-any.whl:

Publisher: publish.yml on ildar-idrisov/gpu-lock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page