amd-agi/primus/slurm-training-node-validation
Claude Code and agent skill by amd-agi/primus
- community
Checking that the SKILL.md file is still in the repository.
Validate SLURM cluster nodes by running actual training jobs in groups. Use when the user wants to test which idle nodes can successfully run training, verify node health through real workloads, or identify broken nodes in a SLURM cluster.
Install
npx vskill@latest install amd-agi/primus/slurm-training-node-validationSKILL.md
SLURM Training Node Validation
Launch short training jobs on groups of idle nodes to determine which nodes are healthy enough to run real workloads.
Prerequisites
Use the slurm-idle-node-check skill first (or manually) to get the list of idle, healthy nodes. If the user has not provided a nodelist, obtain one using the slurm-idle-node-check skill's Step 1 (filter for exactly idle state).
Workflow
Step 0: Pre-flight Checks
Before launching any training, resolve these runtime parameters:
HF_TOKEN
Check if HF_TOKEN is set in the environment:
If it is NOT_SET or empty, ask the user to provide it using AskQuestion or a conversational prompt. Do NOT proceed without a valid HF_TOKEN.
Partition
Determine the SLURM partition to use:
- Check if
amd-aigexists:
``bash sinfo -h -o "%P" | tr -d '*' | sort -u ``
- If
amd-aigis in the list, use it. - If
amd-aigis NOT in the list:
- If there is exactly one partition available, use it automatically.
- If there are multiple partitions, use AskQuestion to let the user pick one.
Store the resolved partition in $PARTITION for use in the launch command.
Runner Script Path
The runner script path is relative to the workspace root, not hardcoded:
Verify it exists before proceeding:
Step 1: Get Idle Nodes and Form Groups
- If the user provides a nodelist, use it. Otherwise, run:
``bash sinfo -h -o "%P %T %N" | awk '$2 == "idle" {print $3}' ` Then expand with scontrol show hostnames <nodelist>` to get individual hostnames.
- If multiple partitions have idle nodes, use AskQuestion to let the user pick a partition.
- Split nodes into groups of 4. If the total is not a multiple of 4, the remaining nodes (fewer than 4) form an incomplete group — skip that group and inform the user which nodes were excluded.
- Display the grouping plan to the user before launching. Example:
`` Group 1: node01,node02,node03,node04 Group 2: node05,node06,node07,node08 Group 3: node09,node10,node11,node12 Skipped (incomplete group): node13 ``
Step 2: Launch Training Jobs
For each group, launch a training job in the background with a dedicated log file.
Directory Structure
Use ./output/ relative to the workspace root. The timestamp is generated once at the start and reused for all groups:
For each group $i, first compress the 4 hostnames into SLURM bracket notation, then create the group directory and marker file:
The `$COMPRESSED_NODELIST` must always be in SLURM prefix-compressed format (e.g. node-[1628,1691,1697,1707]), NOT individual hostnames joined by commas. Always use scontrol show hostlist to produce it.
The resulting directory layout looks like:
Launch Command
For each group (index $i, nodelist $NODELIST), run:
Important details:
- Replace
<nodelist_for_this_group>with the compressed nodelist for this group. Usescontrol show hostlist node01,node02,node03,node04to compress it, or just use the comma-separated list. ${HF_TOKEN}— resolved in Step 0 (from environment or user input).${RUNNER_SCRIPT}— resolved in Step 0 as$(pwd)/runner/primus-cli-slurm.sh.${PARTITION}— resolved in Step 0 (auto-detected or user-selected).- Each group runs in a subshell so environment variables don't leak between groups.
- Capture the PID of each background job:
PIDS[$i]=$! - Log file:
log_group_1.txt,log_group_2.txt, etc. (1-indexed) - The nodelist marker file name embeds the compressed nodelist (e.g.
group_1_nodelist_node-[1628,1691,1697,1707]). The file content is the compressed nodelist string itself.
After launching all groups, print:
Step 3: Wait and Monitor
- Use
waitto wait for all background PIDs to finish:
``bash for i in "${!PIDS[@]}"; do wait ${PIDS[$i]} 2>/dev/null EXIT_CODES[$i]=$? done ``
- Alternatively, poll logs periodically (every 60 seconds) to provide progress updates to the user. Use the Shell tool with appropriate
block_until_msto monitor.
- Early failure detection: While polling, if a log contains
Exited with exit code 1but does NOT containiteration 3, the job has already failed — no need to wait further. Mark it as failed immediately.
- Timeout: If a job hasn't finished after 5 minutes:
- Kill the background process:
kill ${PIDS[$i]} 2>/dev/null - Find and cancel any SLURM jobs launched by this group. Search for jobs on the group's nodes:
``bash # Find SLURM job IDs associated with this group's nodes squeue -u "$USER" -h -o "%i %N" | while read jobid nodes; do # Check if any of this group's nodes appear in the job's nodelist if echo "$nodes" | grep -qF "<any_node_from_this_group>"; then scancel "$jobid" fi done ` Alternatively, if the training script outputs a SLURM job ID in the log, extract and cancel it: `bash JOB_ID=$(grep -oP 'Submitted batch job \K\d+' "${GROUPDIR}/log_group_${i}.txt" 2>/dev/null || true) if [ -n "$JOB_ID" ]; then scancel "$JOB_ID" fi ``
- Mark the group as failed with reason "Timeout after 5 minutes".
Step 4: Check Results and Write Status Files
For each group, determine the result by checking the log file:
Decision logic:
- If
HAS_ITER3 > 0→ PASS (regardless of exit code). - If
HAS_ITER3 == 0andHAS_EXIT1 > 0→ FAIL (process exited with error before reaching iteration 3). - If
HAS_ITER3 == 0andHAS_EXIT1 == 0and job timed out → FAIL (timeout).
Note: The pattern iteration 3 uses 8 spaces between "iteration" and "3". This is the exact pattern printed by Megatron-LM during training. Use grep with the exact string.
On success (pattern found):
Create an empty success file in the group directory:
On failure (pattern not found):
Extract error context and write a failed file with error details:
If the job was killed due to timeout, write:
Important: If a group has a non-zero exit code but the success pattern IS found in the log, still create success (not failed), because training may exit non-zero after completing.
Step 5: Display Results
Always write the summary in English, regardless of the conversation language.
Results Table
Summary
Generating SLURM-format Compressed Nodelists
Collect all individual hostnames for passed (or failed) groups, then compress into SLURM nodelist format:
Example: if passed nodes are node-1628,node-1691,node-1697,node-1707,node-1711,node-1713, then:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/slurm-training-node-validation/SKILL.md
Popularity
- Repository stars
- 120
- Repository forks
- 46
- 7-day trend score
- 24
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/amd-agi/primus/slurm-training-node-validation)