alterlab-remote-compute

$npx mdskill add AlterLab-IEU/AlterLab-Academic-Skills/alterlab-remote-compute

Dispatch long-running GPU/CPU jobs to remote compute via a submit-poll-harvest pattern.

  • Submit batch jobs to SLURM/HPC clusters or managed cloud GPU APIs.
  • Depends on sbatch/squeue/sacct for HPC and provider SDKs for cloud backends.
  • Uses a portable stdlib-only dispatcher that selects backend based on environment.
  • Returns job status and result artifacts to the calling agent or skill.

SKILL.md

.github/skills/alterlab-remote-computeView on GitHub ↗
---
name: alterlab-remote-compute
description: Dispatch long-running GPU/CPU jobs to remote compute with a provider-agnostic submit → poll → harvest pattern across SLURM/HPC (sbatch, squeue, sacct) and managed APIs (Modal, RunPod, GCP Batch / Vertex AI). Use when submitting a batch job to a cluster, polling job status, retrieving result artifacts from a scheduler or cloud GPU provider, or writing a portable job-submission wrapper; the foundation-model skills (alterlab-alphafold, alterlab-boltz, alterlab-rfdiffusion, and siblings) dispatch their GPU work through this pattern. For Modal-specific serverless container deployment and autoscaling prefer alterlab-modal instead. Part of the AlterLab Academic Skills suite.
license: MIT
allowed-tools: Read Write Edit Bash(python:*) Bash(uv:*)
compatibility: "Runs under `uv run python`; the portable dispatcher (`scripts/dispatch.py`) is stdlib-only. SLURM paths need `sbatch`/`squeue`/`sacct` on PATH (an HPC login node); managed backends need the provider CLI/SDK and account credentials read from environment variables (never hardcoded). No GPU is needed to submit/poll — only the remote job itself uses one."
metadata:
    skill-author: AlterLab
    version: "1.0.0"
---

# Remote Compute

## Overview

Foundation-model workloads (protein folding, backbone diffusion, single-cell models) need a
GPU and can run for minutes to hours — too long to sit in a synchronous call. This skill is
the **provider-agnostic dispatch layer** the GPU skills build on: a single **submit → poll →
harvest** contract that works the same whether the backend is a SLURM cluster, Modal, RunPod,
or GCP. You describe the job once; the dispatcher submits it, returns a handle, polls status
to a terminal state, and harvests the output artifacts.

It does **not** wrap any single model — each model skill (`alterlab-alphafold`,
`alterlab-boltz`, `alterlab-proteinmpnn`, …) describes *what* to run; this skill describes
*where and how* to run it.

## When to Use This Skill

Use this skill when the user wants to:
- Submit a batch job to a SLURM/HPC cluster and track it to completion (`sbatch` → `sacct`).
- Run a GPU job on a managed provider (Modal, RunPod, GCP Batch / Vertex AI) and retrieve results.
- Write a portable job wrapper that runs the *same* payload across more than one backend.
- Poll a long-running remote job's status and harvest its output files/artifacts.

### Does NOT Trigger

| Scenario | Use instead |
|----------|-------------|
| Deploy a serverless container / autoscaling API specifically on **Modal** | `alterlab-modal` |
| Actually **fold a structure**, design a sequence, or run a specific model | the model's own skill (`alterlab-alphafold`, `alterlab-boltz`, `alterlab-proteinmpnn`, …) |
| Local single-machine data analysis with no remote dispatch | the relevant analysis skill (`alterlab-scanpy`, `alterlab-rdkit`, …) |
| Query a database over HTTP | the database connector skill (`alterlab-pdb`, `alterlab-uniprot`, …) |

## The submit → poll → harvest contract

Every backend implements three verbs. Keeping the payload backend-independent is what makes a
model skill portable across an HPC allocation and a cloud GPU:

1. **submit(spec) → handle** — enqueue the job; return an opaque handle (SLURM job id, Modal
   call id, RunPod job id, GCP operation name).
2. **poll(handle) → status** — map the backend's states to a common vocabulary:
   `PENDING | RUNNING | SUCCEEDED | FAILED | CANCELLED | UNKNOWN`. Poll on a backoff; never
   busy-loop.
3. **harvest(handle) → artifacts** — copy the declared output files back to a local `out/`
   directory (scp/rsync from HPC scratch; object-store download for cloud).

`scripts/dispatch.py` implements this contract for the SLURM and a generic REST backend, and
defines the status vocabulary so model skills can depend on it. Provider-specific command and
API detail lives in `references/providers.md` (loaded on demand).

## Core Capabilities

### 1. SLURM / HPC clusters

The classic scheduler path. Submit a job script with resource directives, then poll with
`sacct` (authoritative for terminal state) rather than only `squeue` (which drops finished
jobs from its default view):

```bash
# Submit; capture the numeric job id from "Submitted batch job <id>"
JOBID=$(sbatch --parsable run.slurm)

# Poll to a terminal state (COMPLETED / FAILED / CANCELLED / TIMEOUT)
sacct -j "$JOBID" --format=State,ExitCode,Elapsed --noheader --parsable2
```

A minimal GPU job script (`run.slurm`) — one GPU, an 8-hour wall clock, results on scratch:

```bash
#!/bin/bash
#SBATCH --job-name=fold
#SBATCH --gres=gpu:1
#SBATCH --time=08:00:00
#SBATCH --output=%x-%j.out
srun uv run python run_model.py --in input.fasta --out "$SCRATCH/out"
```

Full directive reference, array jobs, and `squeue`/`scancel` usage: see
`references/providers.md`.

### 2. Modal — managed serverless GPU

For serverless containers, autoscaling, and `.remote()` dispatch, this skill defers to
`alterlab-modal`, which owns the Modal SDK surface. Use Modal when you want zero cluster
management and per-second GPU billing. This skill's role is only to treat a Modal call as one
`submit → poll → harvest` backend when a workflow needs to stay provider-agnostic.

### 3. RunPod — on-demand GPU pods

RunPod exposes GPU pods and a serverless endpoint API. Submit to a serverless endpoint and
poll the returned job id; the API key is read from `RUNPOD_API_KEY`. Endpoint/run/status
paths and the pod vs. serverless trade-off are in `references/providers.md`.

### 4. GCP — Batch and Vertex AI

Google Cloud offers **Batch** (containerized batch jobs with GPU allocation) and **Vertex AI**
custom jobs (ML-oriented, managed). Both follow submit → poll (operation/job state) → harvest
(read outputs from a GCS bucket). Auth uses Application Default Credentials; the target bucket
comes from an env var. Command/SDK detail: `references/providers.md`.

### 5. Portable job wrapper

`scripts/dispatch.py` is a stdlib-only CLI that runs the same job spec across backends:

```bash
# Submit a SLURM job and print the handle
python scripts/dispatch.py submit --backend slurm --script run.slurm

# Poll a handle to a normalized status
python scripts/dispatch.py poll --backend slurm --handle 123456

# Generic REST backend (RunPod-style): endpoint + key from env
python scripts/dispatch.py submit --backend rest \
  --endpoint "$RUNPOD_ENDPOINT" --payload spec.json
```

It shells out to `sbatch`/`sacct` for SLURM and uses `urllib` for the REST backend — no
third-party dependencies, so it runs anywhere Python does.

## Validation and status semantics

- **Trust the accounting record, not the queue.** On SLURM, a job missing from `squeue` may
  have finished *or* failed — resolve terminal state with `sacct`/exit code, not absence.
- **Poll with backoff** (e.g. 10s → 30s → 60s, capped) so you neither hammer the scheduler
  nor miss a fast job.
- **Always check the exit code**, not just the state string; a job can report `COMPLETED`
  while the payload wrote no artifacts. Harvest, then verify the expected files exist.
- **Never hardcode credentials.** Read `RUNPOD_API_KEY`, GCP ADC, and cluster hosts from the
  environment; the dispatcher refuses to run if a required secret is unset.

## Resources

- `references/providers.md` — per-backend command/API detail (SLURM directives, RunPod
  endpoints, GCP Batch/Vertex, Modal cross-link) loaded on demand.
- `scripts/dispatch.py` — stdlib-only `submit`/`poll`/`harvest` CLI for SLURM + generic REST.

Part of the AlterLab Academic Skills suite.

More from AlterLab-IEU/AlterLab-Academic-Skills

SkillDescription
alterlab-abm-mesaBuilds agent-based models of social systems with Mesa 3 — the current AgentSet API (model.agents.shuffle_do('step'), auto-assigned unique_id, mandatory super().__init__(seed=...)), cell spaces (mesa.discrete_space OrthogonalMooreGrid / classic mesa.space grids), the DataCollector, batch_run parameter sweeps, and SolaraViz — for emergence, segregation, diffusion, opinion dynamics, and cooperation models. It uses the Mesa 3.x API (the old mesa.time schedulers like RandomActivation are removed) and treats the model as a generative theory to be validated, not just run. Use when the request mentions an agent-based model, Mesa, simulating interacting agents, or emergent macro behavior from micro rules. For discrete-event (queueing/process) simulation prefer alterlab-simpy; for reinforcement learning prefer alterlab-stable-baselines3. Part of the AlterLab Academic Skills suite.
alterlab-academic-careerPrepares academic career documents and professional-development materials for faculty and researchers. Use when drafting academic CVs, research statements, teaching philosophies, diversity statements, faculty-position cover letters, tenure dossiers, promotion narratives, academic portfolios, or mentorship statements, and when planning conference-networking strategy, building academic web presence, setting up ORCID profiles, or understanding impact metrics. Part of the AlterLab Academic Skills suite.
alterlab-accreditation-aolScaffolds program-level Assurance-of-Learning (AoL) documentation for AACSB (2020 Standard 5) and ABET (Criterion 3 Student Outcomes, Criterion 4 Continuous Improvement) accreditation — program learning outcomes / competency goals, curriculum-to-outcome mapping matrices, direct- and indirect-assessment plans, rubric design, and closing-the-loop continuous-improvement narratives — and validates the structure of an outcome-mapping matrix with scripts/aol_matrix.py. Use when the user needs AACSB or ABET assurance-of-learning material, a program-learning-outcomes set, a curriculum/outcome map or coverage matrix, a direct/indirect assessment plan, a closing-the-loop report, or accreditation self-study text. For single-course design or course rubrics prefer alterlab-teaching-design; for post-award grant reports prefer alterlab-grant-reporting. Part of the AlterLab Academic Skills suite.
alterlab-adaptyvSubmits and tracks protein-testing experiments on the Adaptyv Bio Foundry cloud lab (wet-lab validation), and optimizes protein sequences before submission with computational tools (NetSolP, SoluProt, SolubleMPNN, ESM). Use when designing proteins that need wet-lab validation - binding/affinity screening, expression testing, thermostability, or fluorescence assays - or when submitting experiments to the Foundry API, browsing the target catalog, tracking experiment status, retrieving results, or pre-screening sequences for solubility/expression. Triggers on "Adaptyv", "Foundry API", "cloud lab", "biolayer interferometry / BLI", "wet-lab validation". Part of the AlterLab Academic Skills suite.
alterlab-aeonRuns time series machine learning with the aeon library — classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search via scikit-learn compatible APIs. Use when working with temporal data, sequential patterns, or time-indexed observations (univariate or multivariate) that need specialized algorithms beyond standard ML approaches. Part of the AlterLab Academic Skills suite.
alterlab-akademik-tesvikComputes the annual Turkish academic-incentive (akademik teşvik) score for Devlet (state) university öğretim elemanı (academic staff) from a classified activity list, applying the verified Akademik Teşvik Ödeneği Yönetmeliği (2018/11834) Faaliyet Hesaplama Tablosu headline puanları (Proje 20, Araştırma 15, Yayın 30, Patent 30, Atıf 30, Tebliğ 20, Ödül 20) with the k (author-count), p (Q1 1/Q2 0.8/Q3 0.5/Q4 0.25), and r (project-role) coefficients via türü puanı = Σ(faaliyet oranları) × headline (MADDE 8/2), then enforcing the per-type headline ceilings, the 100 cap (MADDE 8/3), and the net-30 payment gate (MADDE 10/3) in a deterministic scripts/tesvik_score.py. Use when the user wants to calculate akademik teşvik puanı, check the en az 30 (net-30) threshold, apply TABLO 4 ceilings, or estimate teşvik eligibility; keeps its coefficients separate from doçentlik scoring. For doçentlik point eligibility prefer alterlab-docentlik-eligibility. Part of the AlterLab Academic Skills suite.
alterlab-alpha-vantageAccesses real-time and historical stock market data, forex rates, cryptocurrency prices, commodities, economic indicators, and 50+ technical indicators via the Alpha Vantage API (requires a free API key from alphavantage.co). Use when fetching stock prices (OHLCV), company fundamentals (income statement, balance sheet, cash flow), earnings, options data, market news/sentiment, insider transactions, GDP, CPI, treasury yields, gold/silver/oil prices, Bitcoin/crypto prices, forex exchange rates, or calculating technical indicators (SMA, EMA, MACD, RSI, Bollinger Bands). Part of the AlterLab Academic Skills suite.
alterlab-alphafoldPredict protein 3D structures with AlphaFold2 via ColabFold — MMseqs2-accelerated MSAs, monomer and AlphaFold2-Multimer complex folding, and confidence-based validation (pLDDT, pTM/ipTM, PAE). Use when folding a protein sequence or complex from FASTA, generating a predicted structure with confidence metrics, ranking models, or checking self-consistency of a design. For co-folding a protein WITH a small-molecule ligand or predicting binding affinity prefer alterlab-boltz; for antibody–antigen or one-FASTA multi-entity complexes prefer alterlab-chai; to LOOK UP an already-computed structure prefer alterlab-alphafold-db; for ESM embeddings or inverse folding prefer alterlab-esm. Part of the AlterLab Academic Skills suite.
alterlab-alphafold-dbAccess the AlphaFold DB of 200M+ AI-PREDICTED protein structures — retrieve models by UniProt accession, download PDB/mmCIF files, and analyze prediction confidence metrics (pLDDT, PAE). Use when a UniProt ID needs a computationally predicted 3D structure or when no experimental structure exists, for homology modeling, protein engineering, or structure-based drug discovery; for EXPERIMENTALLY determined structures (X-ray, cryo-EM, NMR) prefer alterlab-pdb, and for protein sequences, annotations, or accession ID mapping prefer alterlab-uniprot instead. Part of the AlterLab Academic Skills suite.
alterlab-anndataBuild, slice, concatenate, read, and write AnnData annotated data matrices (obs, var, X, layers, obsm, uns) — the scverse data STRUCTURE, not an analysis pipeline. Use when creating or wrangling .h5ad/zarr files, managing cell and gene annotations, concatenating batches, or handling layers/obsm/backed-mode; for the QC, normalization, clustering, UMAP, and differential-expression analysis pipeline prefer alterlab-scanpy instead, and for RNA velocity from spliced/unspliced layers prefer alterlab-scvelo instead. Part of the AlterLab Academic Skills suite.