globus-compute
Skill30 starsChanged 51 days agoBSD-2-ClauseView on GitHub
Submit Python functions as jobs to NERSC Perlmutter via Globus Compute. Use this skill when the user wants to login to Globus, send a compute job, check task status, or get results from a remote HPC endpoint. Covers auth, endpoint configuration via Jinja2 templates, job submission with user_endpoint_config, and result retrieval.
- Installs packages
In this repository30 other files it gives its agents.
- skills/academy/agents.mdAGENTS.md
- academySkill
- amsc-data-movement-apiSkill
- amsc-magSkill
- amsc-python-clientSkill
- i2-apiSkill
- iri-apiSkill
- skill-explorerSkill
- croissant-validatorSkill
- datacard-generatorSkill
- hdmf-schema-builderSkill
- skill-creatorSkill
- well-convertSkill
- card-eval-updaterSkill
- agentic-vulnerabilities-scanSkill
- ai-fingerprintSkill
- battleprintSkill
- fingerprintingSkill
- uncertainty-quantificationSkill
- uq-metrics-evaluatorSkill
- skill-searchSkill
- auroraSkill
- frontierSkill
- pbsSkill
- perlmutterSkill
- slurmSkill
- literature-searchSkill
- multi-agent-systemsSkill
- gkeyllSkill
- gs2Skill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 96
Do NOT set partition — Perlmutter auto-selects from the -C constraint in OPTIONS.
- Distinctive: line 202
Does NOT handle: Globus Transfer, Globus Search, other Globus services, academy/exchange framework integration, or endpoint provisioning …
- Distinctive: line 207
Never log or expose access/refresh tokens.
- Distinctive: line 208
Do not commit token databases or config files containing endpoint IDs to git.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Globus Compute (NERSC)
Submit Python functions to NERSC Perlmutter via globus-compute-sdk using
template-capable endpoints and user_endpoint_config for per-job customization.
Setup
uv venv .venv --python 3.13
uv pip install globus-compute-sdk globus-sdkPython version MUST match the endpoint workers (Perlmutter default: 3.13).
Globus Compute serializes functions as bytecode via dill — version mismatch = opcode errors.
CRITICAL: Login requires interactive terminal
Auth uses browser-based OAuth. input() does NOT work from Claude Code.
Tell user to run login commands directly in their terminal (not via ! prefix).
Architecture
Local (gc_run.py) Globus Compute Service NERSC Perlmutter
───────────────── ────────────────────── ────────────────
Executor.submit(func, Routes task to endpoint Endpoint receives task
user_endpoint_config={ via AMQP queue ↓
NERSC_ACCOUNT: "m0000", Renders config.yaml from
OPTIONS: "#SBATCH ...", user_config_template.yaml.j2
COMMAND: "module load ..." + user_endpoint_config
}) ↓
↓ sbatch → SLURM allocates node
polls for result ←──────────────── result returns ←───────────────── worker executes func → resultTemplate-capable endpoint (on Perlmutter)
The endpoint uses user_config_template.yaml.j2 with Jinja2 variables.
Users pass values at submit time via user_endpoint_config dict — no need to
SSH and edit config.yaml for each job.
Endpoint setup (one-time, on Perlmutter)
ssh <username>@perlmutter.nersc.gov
module load python
pip install --user globus-compute-endpoint
globus-compute-endpoint configure perlmutter
# If prompted, run: globus-compute-endpoint migrate-to-template-capable perlmutterEdit ~/.globus_compute/perlmutter/user_config_template.yaml.j2:
engine:
type: GlobusComputeEngine
worker_debug: False
address:
type: address_by_interface
ifname: hsn0
provider:
type: SlurmProvider
launcher:
type: SrunLauncher
overrides: -c 128
scheduler_options: {{ OPTIONS }}
account: {{ NERSC_ACCOUNT }}
worker_init: {{ COMMAND }}
cmd_timeout: 120
nodes_per_block: 2
init_blocks: 0
min_blocks: 0
max_blocks: 1
walltime: 00:10:00Do NOT set partition — Perlmutter auto-selects from the -C constraint in OPTIONS.
Start it:
globus-compute-endpoint start perlmutter
# → Endpoint UUID: <uuid>Template variables
| Variable | Example | Purpose |
NERSC_ACCOUNT | m0000 | NERSC allocation (required) |
OPTIONS | #SBATCH -C cpu\n#SBATCH -q debug | SLURM scheduler directives |
COMMAND | module load python; source activate myenv | Worker init commands |
Quick start
1. First-time login (user runs in terminal)
.venv/bin/python scripts/gc_auth.py login2. Configure default endpoint (one-time)
.venv/bin/python scripts/gc_run.py config set-endpoint <endpoint_uuid> --name "perlmutter"3. Run sample test (get_hostname)
.venv/bin/python scripts/gc_run.py sample \
--account m0000 \
--options "#SBATCH -C cpu\n#SBATCH -q debug" \
--worker-init "module load python"Expected: SUCCESS: hostname = nid001234 (a Perlmutter compute node)
4. Run a custom function
.venv/bin/python scripts/gc_run.py run my_func.py \
--account m0000 \
--options "#SBATCH -C cpu\n#SBATCH -q debug" \
--worker-init "module load python"5. Check status / get result
.venv/bin/python scripts/gc_run.py status
.venv/bin/python scripts/gc_run.py result <task_id>Python API (inline use)
from globus_compute_sdk import Executor
def get_hostname():
import socket
return socket.gethostname()
endpoint_id = "<endpoint_uuid>"
user_endpoint_config = {
"NERSC_ACCOUNT": "m0000",
"OPTIONS": "#SBATCH -C cpu\n#SBATCH -q debug",
"COMMAND": "module load python",
}
with Executor(endpoint_id=endpoint_id, user_endpoint_config=user_endpoint_config) as ex:
future = ex.submit(get_hostname)
print(future.result()) # nid001234NERSC-specific notes
| Item | Detail |
| Account | Always pass NERSC_ACCOUNT — no default, jobs fail without it |
| No partition | Never set partition — SLURM picks from -C constraint |
| Network | ifname: hsn0 (high-speed fabric) in template, not bond0 |
| Python version | Local and endpoint must match (both 3.13) — bytecode serialization |
| GPU nodes | Use OPTIONS: "#SBATCH -C gpu\n#SBATCH -q debug\n#SBATCH --gpus=4" |
| CPU nodes | Use OPTIONS: "#SBATCH -C cpu\n#SBATCH -q debug" |
| Debug QOS | 30 min max, 8 nodes max, high priority — good for testing |
| Regular QOS | 48h max — use for real workloads |
Auth helper (scripts/gc_auth.py)
.venv/bin/python scripts/gc_auth.py status # check token (non-interactive)
.venv/bin/python scripts/gc_auth.py login # interactive login
.venv/bin/python scripts/gc_auth.py token # print access token
.venv/bin/python scripts/gc_auth.py logout # remove tokensEndpoint management (on Perlmutter)
globus-compute-endpoint list
globus-compute-endpoint start perlmutter
globus-compute-endpoint stop perlmutter
globus-compute-endpoint restart perlmutterScope
Handles Globus Compute job submission, auth, endpoint config via templates. Does NOT handle: Globus Transfer, Globus Search, other Globus services, academy/exchange framework integration, or endpoint provisioning automation.
Security
Never log or expose access/refresh tokens. Token files are mode 600. Do not commit token databases or config files containing endpoint IDs to git.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

