Modern job queue for local and cluster runners
Project description
Molq: Molcrafts Queue Interface
Molq is a unified and flexible job queue system designed for both local execution and cluster computing environments. It provides a clean, decorator-based API that makes it easy to submit, monitor, and manage computational tasks across different execution backends.
✨ Key Features
- 🎯 Unified Interface: Single API for local and cluster execution
- 🐍 Decorator-Based: Simple, Pythonic syntax using decorators
- ⚡ Generator Support: Advanced control flow with generator-based tasks
- 🔌 Multiple Backends: Support for local execution, SLURM clusters, and more
- 📊 Job Monitoring: Built-in status tracking and error handling
- 💾 Resource Management: Flexible resource allocation and cleanup
- 🔄 Job Dependencies: Chain jobs and manage complex workflows
- 📧 Notifications: Email alerts for job status changes
🚀 Quick Start
Installation
pip install molq
Basic Usage
from molq import submit
# Create submitters for different environments
local = submit('dev', 'local') # Local execution
cluster = submit('hpc', 'slurm') # SLURM cluster
@local
def hello_world(name: str):
"""A simple local job."""
job_id = yield {
'cmd': ['echo', f'Hello, {name}!'],
'job_name': 'greeting'
}
return job_id
@cluster
def train_model():
"""A GPU training job on the cluster."""
job_id = yield {
'cmd': ['python', 'train.py'],
'cpus': 16,
'memory': '64GB',
'time': '08:00:00',
'gpus': 2,
'partition': 'gpu'
}
return job_id
# Run jobs
hello_world("Molq")
job_id = train_model()
Command Line Integration
from molq import cmdline
@cmdline
def get_system_info():
"""Execute command and capture output."""
result = yield {'cmd': ['uname', '-a']}
return result.stdout.decode().strip()
system_info = get_system_info()
print(system_info)
📖 Documentation
- Tutorial - Step-by-step guide
- API Reference - Complete API documentation
- Recipes - Real-world examples
- Examples - Practical code examples
🎯 Supported Backends
| Backend | Description | Status |
|---|---|---|
| Local | Local machine execution | ✅ Full support |
| SLURM | HPC cluster scheduler | ✅ Full support |
| PBS/Torque | Legacy cluster scheduler | 🚧 Basic support |
| LSF | IBM cluster scheduler | 🚧 Basic support |
🔧 Advanced Features
Multi-Step Workflows
@cluster
def analysis_pipeline():
# Step 1: Preprocessing
prep_job = yield {
'cmd': ['python', 'preprocess.py'],
'cpus': 8, 'memory': '32GB', 'time': '02:00:00'
}
# Step 2: Analysis (depends on preprocessing)
analysis_job = yield {
'cmd': ['python', 'analyze.py'],
'cpus': 16, 'memory': '64GB', 'time': '08:00:00',
'dependency': prep_job # Wait for preprocessing
}
return [prep_job, analysis_job]
Error Handling
@cluster
def robust_job():
try:
return yield {'cmd': ['python', 'risky_script.py']}
except Exception:
# Fallback to safer approach
return yield {'cmd': ['python', 'safe_script.py']}
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Inspired by Hamilton for dataflow patterns
- Built for the scientific computing and HPC community
Project details
Release history Release notifications | RSS feed
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.1.0.tar.gz.
File metadata
- Download URL: molcrafts_molq-0.1.0.tar.gz
- Upload date:
- Size: 37.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dce4ca04bcf38ab96c571d529b8e9781e30ea8ddbc4a4332eae6ed6e4033a82
|
|
| MD5 |
48c7daaacf9366a71b4e6856545dfdd7
|
|
| BLAKE2b-256 |
37a884b8556afad4c1fe830e26f7641494951e0dc88112feaa918bbed1b1cf82
|
Provenance
The following attestation bundles were made for molcrafts_molq-0.1.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.1.0.tar.gz -
Subject digest:
2dce4ca04bcf38ab96c571d529b8e9781e30ea8ddbc4a4332eae6ed6e4033a82 - Sigstore transparency entry: 248677675
- Sigstore integration time:
-
Permalink:
MolCrafts/molq@a95208f871bec72f33b85ba99134264be2bbcc1d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MolCrafts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a95208f871bec72f33b85ba99134264be2bbcc1d -
Trigger Event:
release
-
Statement type:
File details
Details for the file molcrafts_molq-0.1.0-py3-none-any.whl.
File metadata
- Download URL: molcrafts_molq-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
694dde8871bda877ca66e0f3012f7ac02d808f5f18bbf81b56dca9d6482c7668
|
|
| MD5 |
ec72562bf719f48b5e39004acdf02f67
|
|
| BLAKE2b-256 |
a1e043243d766cc755ecbd6caf371f2469cd7c188b101cb76bab6dc3a0496680
|
Provenance
The following attestation bundles were made for molcrafts_molq-0.1.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.1.0-py3-none-any.whl -
Subject digest:
694dde8871bda877ca66e0f3012f7ac02d808f5f18bbf81b56dca9d6482c7668 - Sigstore transparency entry: 248677676
- Sigstore integration time:
-
Permalink:
MolCrafts/molq@a95208f871bec72f33b85ba99134264be2bbcc1d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MolCrafts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a95208f871bec72f33b85ba99134264be2bbcc1d -
Trigger Event:
release
-
Statement type: