Unified job queue for local execution and HPC schedulers
Project description
molq
Unified job queue — one submission API for local, SLURM, PBS, and LSF
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
| Module | Capability |
|---|---|
cluster |
Cluster — destination spec: scheduler kind × transport × scheduler options, plus live queue snapshots |
submitor |
Submitor + JobHandle — single entry point for submitting, tracking, and waiting on jobs |
scheduler |
Scheduler protocol with Shell, Slurm, PBS, and LSF backends, each routing shell calls through a transport |
transport |
LocalTransport / SshTransport — runs shell and file ops here or on a remote host via OpenSSH |
store |
JobStore — SQLite persistence with WAL mode, UUID job identity, schema versioning, and v1 auto-migration |
reconciler |
JobReconciler — batch-queries schedulers, diffs against the store, syncs job state |
monitor |
Blocking waits and polling engine driven by pluggable strategies |
strategies |
Pluggable polling strategies; exponential backoff by default |
callbacks |
EventBus — synchronous pub/sub for job lifecycle events with handler isolation |
models |
Job data models — JobRecord, RetryPolicy, RetentionPolicy, JobDependency, SubmitorDefaults |
types |
Frozen value types — Memory, Duration, Script, JobResources, JobScheduling, JobExecution |
options |
Per-scheduler frozen option dataclasses (Local, Slurm, PBS, LSF) — no untyped dicts |
config |
Profile and config loading from molcfg (~/.molcrafts/molq/config/config.toml, or MOLCRAFTS_HOME) |
plugin |
MolqPlugin host — official builtins + third-party entry points (molq.plugins) |
plugins |
Official plugins (e.g. nerve → local Nerve menu-bar status; fail-open) |
workspace |
Workspace / Project — directory handles over a cluster's filesystem (local or remote) |
ssh_config |
Surfaces ~/.ssh/config hosts as cluster candidates |
serde |
Serialization helpers for stored requests and config-driven values |
errors |
Unified MolqError exception hierarchy with typed context |
status |
JobState enum with terminal-state semantics |
merge |
Pure function that merges per-submit parameters with Submitor defaults |
dashboard |
Full-screen terminal dashboard for monitoring runs and jobs |
testing |
FakeScheduler and make_submitor for tests and runnable examples without a real cluster |
cli |
Typer + 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
- Getting Started — installation and your first job
- Concepts — Cluster, Submitor, Scheduler, Transport, Workspace, Project
- Schedulers — scheduler matrix and option classes
- Monitoring — lifecycle, reconciliation, polling, and dashboards
- CLI Reference — command-line usage
- API Reference — exported classes, enums, options, and errors
MolCrafts ecosystem
| Project | Role |
|---|---|
| molpy | Python toolkit — the shared molecular data model & workflow layer |
| molrs | Rust core — molecular data structures & compute kernels (native + WASM) |
| molpack | Packmol-grade molecular packing (Rust + Python) |
| molvis | WebGL molecular visualization & editing |
| molexp | Workflow & experiment-management platform |
| molnex | Molecular machine-learning framework |
| molq | Unified job queue — local / SLURM / PBS / LSF — this repo |
| molcfg | Layered configuration library |
| mollog | Structured logging, stdlib-compatible |
| molhub | Molecular dataset hub |
| molmcp | MCP server for the ecosystem |
| molrec | Atomistic record specification |
Contributing
Issues and pull requests are welcome — see the docs for development setup.
License
MIT — see LICENSE.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file molcrafts_molq-0.6.0.tar.gz.
File metadata
- Download URL: molcrafts_molq-0.6.0.tar.gz
- Upload date:
- Size: 135.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b3d185be3b823da1e05dc8299fef6e82c934df14f13156e6a4862f2775799c5
|
|
| MD5 |
3016cda39213fc1db7ca1d4a64d2dcc5
|
|
| BLAKE2b-256 |
3a2cf28f1d8ecd94756d48825b06b72a2c116d1fffd0be062e6fbcba61e4e6a5
|
Provenance
The following attestation bundles were made for molcrafts_molq-0.6.0.tar.gz:
Publisher:
release.yml on MolCrafts/molq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
molcrafts_molq-0.6.0.tar.gz -
Subject digest:
6b3d185be3b823da1e05dc8299fef6e82c934df14f13156e6a4862f2775799c5 - Sigstore transparency entry: 2218412068
- Sigstore integration time:
-
Permalink:
MolCrafts/molq@8ca2711f104509d61e682223c2fbf516ee8c26f2 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/MolCrafts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8ca2711f104509d61e682223c2fbf516ee8c26f2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file molcrafts_molq-0.6.0-py3-none-any.whl.
File metadata
- Download URL: molcrafts_molq-0.6.0-py3-none-any.whl
- Upload date:
- Size: 94.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a66c7b795076f8d68466d05101470e13e8a1037d4fa8b00533a8627a8f10f750
|
|
| MD5 |
3afc88c2d9240a84b3c636fd22c0e45f
|
|
| BLAKE2b-256 |
3359d8c29a6909643c4bcb931b48af0338ae84885216b47065fa61b99ed737ea
|
Provenance
The following attestation bundles were made for molcrafts_molq-0.6.0-py3-none-any.whl:
Publisher:
release.yml on MolCrafts/molq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
molcrafts_molq-0.6.0-py3-none-any.whl -
Subject digest:
a66c7b795076f8d68466d05101470e13e8a1037d4fa8b00533a8627a8f10f750 - Sigstore transparency entry: 2218412111
- Sigstore integration time:
-
Permalink:
MolCrafts/molq@8ca2711f104509d61e682223c2fbf516ee8c26f2 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/MolCrafts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8ca2711f104509d61e682223c2fbf516ee8c26f2 -
Trigger Event:
push
-
Statement type: