README.md

July 22, 2026 · View on GitHub

 molq

Unified job queue — one submission API for local, SLURM, PBS, and LSF

CI PyPI Python License Ruff

Documentation  ·  Quick start  ·  Ecosystem

molq is a unified job queue for Python workloads that need the same submission API on a laptop, a workstation, or an HPC cluster. A Cluster says where jobs run, a Submitor tracks how they progress — and the same code runs against local subprocesses or remote schedulers over SSH.

Under active development. Public APIs may change between minor releases.

Capabilities

ModuleCapability
clusterCluster — destination spec: scheduler kind × transport × scheduler options, plus live queue snapshots
submitorSubmitor + JobHandle — single entry point for submitting, tracking, and waiting on jobs
schedulerScheduler protocol with Shell, Slurm, PBS, and LSF backends, each routing shell calls through a transport
transportLocalTransport / SshTransport — runs shell and file ops here or on a remote host via OpenSSH
storeJobStore — SQLite persistence with WAL mode, UUID job identity, schema versioning, and v1 auto-migration
reconcilerJobReconciler — batch-queries schedulers, diffs against the store, syncs job state
monitorBlocking waits and polling engine driven by pluggable strategies
strategiesPluggable polling strategies; exponential backoff by default
callbacksEventBus — synchronous pub/sub for job lifecycle events with handler isolation
modelsJob data models — JobRecord, RetryPolicy, RetentionPolicy, JobDependency, SubmitorDefaults
typesFrozen value types — Memory, Duration, Script, JobResources, JobScheduling, JobExecution
optionsPer-scheduler frozen option dataclasses (Local, Slurm, PBS, LSF) — no untyped dicts
configProfile and config loading from molcfg (~/.molcrafts/molq/config/config.toml, or MOLCRAFTS_HOME)
pluginMolqPlugin host — official builtins + third-party entry points (molq.plugins)
pluginsOfficial plugins (e.g. nerve → local Nerve menu-bar status; fail-open)
workspaceWorkspace / Project — directory handles over a cluster's filesystem (local or remote)
ssh_configSurfaces ~/.ssh/config hosts as cluster candidates
serdeSerialization helpers for stored requests and config-driven values
errorsUnified MolqError exception hierarchy with typed context
statusJobState enum with terminal-state semantics
mergePure function that merges per-submit parameters with Submitor defaults
dashboardFull-screen terminal dashboard for monitoring runs and jobs
testingFakeScheduler and make_submitor for tests and runnable examples without a real cluster
cliTyper + Rich CLI: jobs (submit/list/status/logs/cancel/…), live (watch/monitor/daemon), setup (clusters/workspace/plugins)

Install

pip install molcrafts-molq

Requires Python 3.12+. Depends on typer, rich, molcrafts-mollog, and molcrafts-molcfg.

Quick start

import molq as mq

# Cluster = destination (where to run). Submitor = lifecycle (how jobs are tracked).
cluster = mq.Cluster("devbox", "local")
submitor = mq.Submitor(target=cluster)

handle = submitor.submit_job(
    argv=["python", "train.py"],
    resources=mq.JobResources(
        cpu_count=4,
        memory=mq.Memory.gb(8),
        time_limit=mq.Duration.hours(2),
    ),
)

record = handle.wait()
print(record.state)

Swap to a cluster by changing one line — mq.Cluster("hpc", "slurm", host="user@hpc.example.com") — and the rest of the code is unchanged. See the docs for retries, dependencies, profiles, and the CLI.

Documentation

MolCrafts ecosystem

ProjectRole
molpyPython toolkit — the shared molecular data model & workflow layer
molrsRust core — molecular data structures & compute kernels (native + WASM)
molpackPackmol-grade molecular packing (Rust + Python)
molvisWebGL molecular visualization & editing
molexpWorkflow & experiment-management platform
molnexMolecular machine-learning framework
molqUnified job queue — local / SLURM / PBS / LSF — this repo
molcfgLayered configuration library
mollogStructured logging, stdlib-compatible
molhubMolecular dataset hub
molmcpMCP server for the ecosystem
molrecAtomistic record specification

Contributing

Issues and pull requests are welcome — see the docs for development setup.

License

MIT — see LICENSE.


Crafted with 💚 by MolCrafts