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, stored under the submission working directory unless overridden

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

By default, ~/.molq stores global state such as config.toml and jobs.db. Per-job artifacts such as generated scripts, manifests, and default logs are written under the submission working directory at .molq/jobs/<job-id>/ unless you override jobs_dir or explicit output paths.

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.4.0.tar.gz (107.9 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.4.0-py3-none-any.whl (72.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: molcrafts_molq-0.4.0.tar.gz
  • Upload date:
  • Size: 107.9 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.4.0.tar.gz
Algorithm Hash digest
SHA256 59624e43b7beca96674356acec8c452dabe1b8069bc84a0ff410a1fef51fce70
MD5 8e1b5301a8ba81875d9380c3a525a6ff
BLAKE2b-256 37bc9a3a6ca97aaf01dac9b845638c13b86664d48ea6cd9c5adad2c153d3dcfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for molcrafts_molq-0.4.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: molcrafts_molq-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 72.8 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eac6bd4252c1690b02faf74b722f0192bb4b28b08d9d090155571f4cd90c03f3
MD5 d0ece29f4e633484acf31a89cce6184c
BLAKE2b-256 70212a5bc8cfed76047266477a18074373b892a445982d506ffb007ccca441d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for molcrafts_molq-0.4.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