Skip to content

Add kaggle kernels logs CLI command#966

Open
kaggle-agent wants to merge 2 commits intomainfrom
agent/bovard-20260410183000-fc1c6e01
Open

Add kaggle kernels logs CLI command#966
kaggle-agent wants to merge 2 commits intomainfrom
agent/bovard-20260410183000-fc1c6e01

Conversation

@kaggle-agent
Copy link
Copy Markdown
Collaborator

There's no way to view kernel execution logs directly in the terminal,
especially for in-progress runs. This adds a logs subcommand that
prints log output to stdout, with --follow/-f for continuous
polling (like tail -f) that stops on terminal kernel states.

Co-authored-by: kaggle-agent kaggle-agent@users.noreply.github.com


Task: bovard-20260410183000-fc1c6e01
Context: https://chat.kaggle.net/kaggle/pl/idq4xpn8djd59j3nsowkaf744c

There's no way to view kernel execution logs directly in the terminal,
especially for in-progress runs. This adds a `logs` subcommand that
prints log output to stdout, with `--follow`/`-f` for continuous
polling (like `tail -f`) that stops on terminal kernel states.

Co-authored-by: kaggle-agent <kaggle-agent@users.noreply.github.com>
interval: Polling interval in seconds for follow mode (default 5).
"""
kernel = kernel or kernel_opt
terminal_statuses = {"complete", "error", "cancelAcknowledged"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just passing by: I thought status was an enum. It is definitely an enum on the server side: KernelWorkerStatus. Can you check if kapigen serializes this as string or an enum in kaggle-sdk repo?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already addressed in the previous round. Confirmed that kapigen serializes status as a KernelWorkerStatus enum (not a string) — KernelWorkerStatus.COMPLETE == "complete" returns False. Updated the code to import KernelWorkerStatus from kagglesdk.kernels.types.kernels_enums and compare against enum members (KernelWorkerStatus.COMPLETE, KernelWorkerStatus.ERROR, KernelWorkerStatus.CANCEL_ACKNOWLEDGED). Tests were also updated accordingly.

There's no way to view kernel execution logs directly in the terminal,
especially for in-progress runs. This adds a `logs` subcommand that
prints log output to stdout, with `--follow`/`-f` for continuous
polling (like `tail -f`) that stops on terminal kernel states.

Uses KernelWorkerStatus enum values for terminal status comparison
rather than raw strings.

Co-authored-by: kaggle-agent <kaggle-agent@users.noreply.github.com>
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.

3 participants