Kaggle / Kaggle/kaggle-cli

Add kernel-session cancellation via --session-id

Open
#1,169 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.5k
Forks
1.4k
Avg merge
3d 15h
Merged PRs (30d)
11

Description

## Problem

`kaggle kernels` has no command for stopping an accidentally submitted run. The public API already exposes `ApiCancelKernelSessionRequest`, but the public CLI does not expose it.

## Reproduction and API boundary

With `kaggle==2.2.4`, `kaggle kernels --help` exposes no cancellation command.

I also validated the existing status endpoint against a real private CPU kernel while it was `RUNNING`: its raw response contains `status` and `failureMessage`, but no `kernelSessionId`. `GetKernel` likewise exposes metadata and source but no current session identity. Therefore closed PR #967 cannot reliably implement a kernel-reference form by extracting an ID from the public status response.

The Kaggle editor has a separate internal API that returns run IDs, but the CLI should not depend on that undocumented web API.

## Requested behavior

Add the small supported public-API wrapper:

```bash
kaggle kernels cancel --session-id SESSION_ID
```

It should invoke the existing cancel-session endpoint, surface its error message, and not delete the kernel, inputs, or historical outputs.

A future `kaggle kernels cancel OWNER/KERNEL-SLUG` needs a public API contract that resolves a kernel reference to a cancellable session ID; that is intentionally out of scope here.

## Proposed contribution

I will submit a focused CLI command with parser and API-wrapper tests. The implementation will use only the supported generated SDK request, not raw web requests.

Contributor guide

Open the contributing guide

Research direction

The entry point is `kaggle kernels cancel --session-id SESSION_ID`; start by locating the existing generated `ApiCancelKernelSessionRequest` usage and the kernels command parser. Add parser and API-wrapper tests for cancellation, error propagation, and preserving kernel data; done means the command uses the supported SDK API without relying on the undocumented web API.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.