Add a CLI command to cancel an active kernel session
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 1.4k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 11
Description
## Workflow
Automated GPU jobs need a way to stop a stale or runaway kernel session without deleting the kernel or using the web UI. The public SDK already exposes `ApiCancelKernelSessionRequest` at `POST /api/v1/kernels/cancel-session/{kernel_session_id}`, but the official CLI has no corresponding `kaggle kernels` command.
`kaggle kernels push` already prints the numeric `versionNumber`; that value is accepted by the cancellation endpoint as the kernel session id.
## Expected CLI
```bash
kaggle kernels cancel
```
The command should issue the existing SDK cancellation request and report that cancellation was requested. It should reject non-positive IDs and surface a backend rejection.
## Proposed scope
A small wrapper in `KaggleApi`, an argparse subcommand, focused unit coverage, and one documentation section. No change to the backend API or existing CLI behavior.
I have a tested implementation ready and can open a PR.
Contributor guide
Research direction
Start with the KaggleApi wrapper and the argparse entry point for `kaggle kernels push`, then trace the existing `ApiCancelKernelSessionRequest` at its cancellation endpoint. Done means `kaggle kernels cancel ` validates positive IDs, reports the requested cancellation, surfaces backend rejection, has focused unit coverage, and includes the planned documentation section.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, cli, documentation, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100