Skip to content

Add runplz kill / runplz cancel subcommand for running jobs #67

Description

@iskandr

Problem

When a remote job (runplz brev/runplz ssh) is mid-flight and needs to be stopped — e.g. wall-time bug, a planned bigger refactor before the run finishes, OOM error that survived the orchestrator's exit, or just an unsupervised retry loop spinning — there's no first-class way to cancel it. The current workflow is:

  1. ssh <instance> (sometimes through a proxy)
  2. pgrep -af <job-keyword> to find pids
  3. pkill -TERM -f <pattern> (often survives), then pkill -KILL -f <pattern>
  4. Verify GPU is idle (nvidia-smi) so a relaunch doesn't OOM

This is fragile — you have to remember the right keyword, and when the orchestrator's bash supervisor has already died (heartbeat dead, only worker spawn_main processes left, all parented to init), pkill -P doesn't help and you fall back to pkill -KILL.

Desired feature

A subcommand that, given a runplz run identifier (or the --instance flag plus a run id from ~/runplz-runs/<run_id>/), cleanly stops the job: kills the orchestrator + all spawned workers + any forked DataLoader children, frees device memory, writes a final event=killed_by_user to events.ndjson. Sketch:

runplz kill --instance mhcflurry-release-exact <run-id>
runplz kill --host my-ssh-alias <run-id>      # via ssh backend

Or using the existing run-id discovery:

runplz ls --instance mhcflurry-release-exact   # list active runs
runplz kill --instance mhcflurry-release-exact --latest

Bonus / nice-to-have

  • runplz kill --signal TERM first, escalate to KILL after a configurable timeout (e.g. 10 sec) if procs survive.
  • Print final disposition (procs killed, GPUs freed, heartbeat last-seen, log-tail).
  • runplz status --instance ... to peek without killing — useful for a "is anything still running?" check before relaunch.
  • Idempotent: re-running on an already-dead run should exit 0 with a message, not error.

Context

I'm running mhcflurry release training and minibatch sweeps via runplz brev against MassedCompute 8×A100-80G boxes. After several rounds of "stop the sweep, fix a perf bug, re-launch", the manual SIGTERM/SIGKILL/nvidia-smi-check dance is the most error-prone step in the workflow. A first-class kill would also make CI-style cancel-on-superseded retries clean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions