Agent Skillsredai-infra/Relax › ssh-ray-cluster

ssh-ray-cluster

GitHub

通过SSH远程连接Ray集群,执行提交任务、检查日志和分析修复错误的三步调试循环,直至问题 resolved。

skills/ssh-ray-cluster/SKILL.md redai-infra/Relax

Trigger Scenarios

用户请求远程调试Ray任务 需要排查分布式训练或推理任务的运行时错误

Install

npx skills add redai-infra/Relax --skill ssh-ray-cluster -g -y
More Options

Use without installing

npx skills use redai-infra/Relax@ssh-ray-cluster

指定 Agent (Claude Code)

npx skills add redai-infra/Relax --skill ssh-ray-cluster -a claude-code -g -y

安装 repo 全部 skill

npx skills add redai-infra/Relax --all -g -y

预览 repo 内 skill

npx skills add redai-infra/Relax --list

SKILL.md

Frontmatter
{
    "name": "ssh-ray-cluster",
    "description": "3-step debug loop for remote Ray cluster — submit task via SSH, check logs locally, analyze errors and fix code, repeat until resolved."
}

SSH Debug Loop

Three-step cycle: submit -> check logs -> analyze & fix -> repeat.

Prerequisites

Read SSH credentials and RELAX_PROJECT_ROOT from auto-memory (reference_ray_cluster_ssh.md). Ask the user if missing — never hard-code in this file.

Step 1: Submit Task via SSH

Use paramiko to SSH into the cluster, cd to the project root, and execute the user's command.

python3 -c "
import paramiko, shlex
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(HOST, port=PORT, username=USER, password=PASS, timeout=10)
cmd = f'cd {shlex.quote(RELAX_PROJECT_ROOT)} && <USER_COMMAND>'
try:
    stdin, stdout, stderr = ssh.exec_command(cmd, timeout=60)
    print(stdout.read().decode())
    err = stderr.read().decode()
    if err: print('STDERR:', err)
except Exception: pass  # long-running commands may timeout — that's OK
finally: ssh.close()
"

Key rule: All project-relative commands (bash scripts/..., tail log/...) MUST have cd $RELAX_PROJECT_ROOT && in the same command string. Paramiko opens a fresh shell each call.

For backgrounded launches, verify separately:

pgrep -af 'ray-job.sh' | head
ray job list 2>&1 | grep RUNNING | head

Step 2: Check Logs Locally

The log file is on a shared filesystem mounted locally. Read it directly:

# Find the latest log
ls -lt log/<model>-*.log | head -5

# Read the tail for errors
tail -200 log/<run-name>.log

Use the Read tool on the log file path. Search for keywords: Error, Exception, Traceback, FAILED, RuntimeError, AssertionError.

Check frequency: Wait at least 1 minute between log checks. Don't poll more frequently — training jobs take minutes to hours, and frequent checks waste context.

Step 3: Analyze & Fix

  1. Identify the error from the log (traceback, error message, hang pattern).
  2. Fix the code if the root cause is clear — edit the source file directly.
  3. Add debug logging if the root cause is unclear — add targeted logger.info/logger.error calls to narrow down the issue.
  4. Go back to Step 1 — resubmit the task and repeat until resolved.

Safety Rules

NEVER execute these without explicit user request:

  • ray stop, bash scripts/tools/kill_for_ray.sh, pkill, ray job stop
  • rm -rf on /tmp/ray/ or session directories

Only ray serve shutdown -y is allowed pre-submit (when user requests a relaunch).

Read-only inspection (ray status, ray job list, ray job logs, nvidia-smi, tail, grep, ps) is always safe.

Version History

  • 039ce87 Current 2026-07-24 22:15

Same Skill Collection

skills/code-review/SKILL.md
skills/creating-skills/SKILL.md
skills/debug-hang/SKILL.md
skills/dev/SKILL.md
skills/doc-writer/SKILL.md
skills/git-commit/SKILL.md
skills/model-integration/SKILL.md
skills/nemo-gym-recipe-integration/SKILL.md
skills/perf-doctor/SKILL.md
skills/redaccel-to-relax/SKILL.md
skills/sglang-upgrade/SKILL.md
skills/sync-github/SKILL.md
skills/verl-to-relax/SKILL.md

Metadata

Files
0
Version
98a7234
Hash
f7288b6d
Indexed
2026-07-24 22:15

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 17:19
浙ICP备14020137号-1 $방문자$