Skip to main content

Unified job queue for local execution and HPC schedulers

Project description

molq

CI PyPI Python License Ruff pre-commit

Unified job queue for Python workloads that need the same submission API on a laptop, workstation, or HPC cluster.

Quick Start

pip install molcrafts-molq
from molq import Duration, JobResources, Memory, Submitor

local = Submitor("devbox", "local")

job = local.submit(
    argv=["python", "train.py"],
    resources=JobResources(
        cpu_count=4,
        memory=Memory.gb(8),
        time_limit=Duration.hours(2),
    ),
)

record = job.wait()
assert record.state.value == "succeeded"

Features

  • One Submitor API for local, slurm, pbs, and lsf
  • Typed submission inputs with Memory, Duration, Script, JobResources, JobScheduling, and JobExecution
  • SQLite-backed persistence with WAL mode and UUID job identities
  • Reconciliation and blocking waits through JobReconciler and JobMonitor
  • First-class retry lineage with persisted attempt history
  • Molq job-id dependencies and inspectable dependency metadata
  • Profiles from ~/.molq/config.toml plus reusable defaults
  • Cleanup and lightweight daemon workflows for retention and reconciliation
  • Event hooks through EventBus
  • Rich CLI for submit, list, status, watch, logs, history, inspect, cleanup, daemon, monitor, and cancel
  • Default stdout/stderr capture for every submitted job

Retry and Dependency Example

from molq import RetryBackoff, RetryPolicy, Submitor

slurm = Submitor("hpc", "slurm")

train = slurm.submit(
    argv=["python", "train.py"],
    retry=RetryPolicy(
        max_attempts=3,
        backoff=RetryBackoff(initial_seconds=10, maximum_seconds=60),
    ),
)

eval_job = slurm.submit(
    argv=["python", "eval.py"],
    after_success=[train.job_id],
)

Profile Example

~/.molq/config.toml

[profiles.gpu]
scheduler = "slurm"
cluster_name = "hpc"

[profiles.gpu.defaults.resources]
cpu_count = 8
memory = "34359738368"

[profiles.gpu.defaults.scheduling]
queue = "gpu"

[profiles.gpu.retry]
max_attempts = 3

CLI usage:

molq submit slurm --profile gpu python train.py
molq daemon slurm --profile gpu --once
molq cleanup slurm --profile gpu --dry-run

Documentation


Built by MolCrafts with love.

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

molcrafts_molq-0.2.0.tar.gz (80.5 kB view details)

Uploaded Source

Built Distribution

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

molcrafts_molq-0.2.0-py3-none-any.whl (59.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for molcrafts_molq-0.2.0.tar.gz
Algorithm Hash digest
SHA256 313ead7bfe2bfe961fb21fb0d050dae6ffbc690064ca48a732cd6c6b8c4f2944
MD5 6df2d351d5361a6b654bf3c1118a150f
BLAKE2b-256 ed70a2cd39d9b53a68f261256f5aa3f7bedd3a5cac176496b4f26c58ed73fe3d

See more details on using hashes here.

Provenance

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

Publisher: release.yml on MolCrafts/molq

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

File details

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

File metadata

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

File hashes

Hashes for molcrafts_molq-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67b92779355ec006165ea31a94526d529573f3f86d341e68274548ef82fbbe72
MD5 d31599b7582175840d717de5d2ca4692
BLAKE2b-256 7e5c52d27f7c4dee4ff1a6d81dd459374251c8f5b5c074fb35d714bc81761f3a

See more details on using hashes here.

Provenance

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

Publisher: release.yml on MolCrafts/molq

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