Skip to content

feat(cli): add command to cancel an active kernel session - #1174

Closed
latiefdole wants to merge 3 commits into
Kaggle:mainfrom
latiefdole:feat/cancel-kernel-session
Closed

feat(cli): add command to cancel an active kernel session#1174
latiefdole wants to merge 3 commits into
Kaggle:mainfrom
latiefdole:feat/cancel-kernel-session

Conversation

@latiefdole

Copy link
Copy Markdown
Contributor

Description

Adds kaggle kernels cancel <SESSION_ID> command to stop a stale or runaway kernel session without deleting the kernel. This command wraps the existing ApiCancelKernelSessionRequest in the Kaggle SDK.

Changes Made

  • cli.py: Added kernels cancel parser, accepting a single positional session_id.
  • kaggle_api_extended.py: Added kernels_cancel to call cancel_kernel_session via kernels_api_client.
  • test_cli_kernels.py: Added unit tests to verify the command parser parses the ID correctly.
  • kernels.md: Documented the new command.

Related Issues

Fixes #1169
Fixes #1172

Three small, output-compatible usability fixes aimed at people running the CLI
for the first time. None of them change the output of a successful command.

Errors: API failures printed the raw requests error, so a mistyped reference
produced a bare "404 Client Error for url: ..." with no indication of what to
do next. Add a hint under the original message for the statuses a user can act
on (403 rules, 404 reference/search, 429 backoff) and attribute 5xx to Kaggle
rather than to the user's command. The message itself is preserved.

Unexpected errors: only HTTPError/IOError/ValueError were caught, so an
internal KeyError or AttributeError surfaced as a Python traceback that reads
like the user did something wrong. Catch the rest, print a one-line summary
plus a pointer to the issue tracker, and add --debug to get the traceback back
for bug reports.

Help: `kaggle --help` listed commands but showed no examples. Add an epilog
with the handful of commands a new user actually starts with (log in, list,
download, submit).
@stevemessick

Copy link
Copy Markdown
Contributor

/gcbrun

@stevemessick

Copy link
Copy Markdown
Contributor

kaggle k push returns the notebook version number, not the session ID. A session ID is like a *nix PID, and is not currently exposed outside the server. This function cannot be implemented yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a CLI command to cancel an active kernel session Add kernel-session cancellation via --session-id

2 participants