Skip to content

Add a CLI command to cancel an active kernel session #1172

Description

@ternaus

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

kaggle kernels cancel <SESSION_ID>

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.

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