Skip to content

feat(cli): add --no-run to kernels push to save a version without running it - #1185

Open
aadi-joshi wants to merge 1 commit into
Kaggle:mainfrom
aadi-joshi:feat/kernels-push-no-run
Open

feat(cli): add --no-run to kernels push to save a version without running it#1185
aadi-joshi wants to merge 1 commit into
Kaggle:mainfrom
aadi-joshi:feat/kernels-push-no-run

Conversation

@aadi-joshi

Copy link
Copy Markdown
Contributor

Summary

kaggle kernels push always queues a full execution, so correcting a typo in a markdown cell means re-running the whole notebook. This adds --no-run, which saves a new version without executing it, the equivalent of Quick Save in the web UI.

Problem

There is no way to save a version without running it. I hit this during a playground competition, where a one word fix in a markdown cell cost a full re-run, twice.

kernels push accepts only -p/--path, -t/--timeout and --accelerator.

Solution

The API already supports this and the CLI was not passing it through. ApiSaveKernelRequest carries:

kernel_execution_type (KernelExecutionType)
  Which kernel version type to use.

and the pinned kagglesdk has:

class KernelExecutionType(enum.Enum):
  KERNEL_EXECUTION_TYPE_UNSPECIFIED = 0
  SAVE_AND_RUN_ALL = 1
  INTER_ACTIVE = 2
  QUICK_SAVE = 3

kernel_execution_type did not appear anywhere in kaggle_api_extended.py or cli.py, so every push left it unspecified and the server saved and ran.

--no-run sets the field to QUICK_SAVE. The default path does not set it at all, so nothing changes for existing users. No kagglesdk bump is needed.

The success message is adjusted for that case, because pointing at run progress when nothing is running would be misleading:

kaggle kernels push -p my-kernel
Kernel version 2 successfully pushed.  Please check progress at https://www.kaggle.com/code/...

kaggle kernels push -p my-kernel --no-run
Kernel version 1 successfully saved without running.  See https://www.kaggle.com/code/...

Testing

  • hatch -e test run pytest tests/unit/test_kernels_push_no_run.py -v (7 passed)
  • hatch -e test run pytest tests/unit (1318 passed, 3 skipped)
  • hatch run lint:all
  • Verified against the live API by pushing the same private notebook twice, with a single cell of print("MARKER") followed by time.sleep(40):
push status the notebook's own output in the log
--no-run RUNNING, then COMPLETE after 24s absent
unchanged RUNNING for 60s, then COMPLETE present once

The quick saved version settled in less time than its own sleep and its log holds no cell output, so the version was created without the cells being executed. The control run behaves exactly as before.

  • Maintainer: please run /gcbrun when convenient

New tests cover that --no-run sets QUICK_SAVE, that a default push leaves the execution type unset, that --accelerator and --timeout still apply alongside it, that both CLI wrappers forward the flag, and that each of the two success messages is produced. Seven of the nine fail against the previous code; the two that do not are the regression guards on the default path.

Docs updated in docs/kernels.md and skills/references/kernels.md.

A note on the flag name

I went with --no-run because it matches the request in #493 and the existing --no-resume, --no-compress, --no-warn style in this CLI. --quick-save would match the web UI and the enum more literally. Happy to rename if you prefer that.

Worth being precise about what it does: a session is still created briefly to render the version, so kernels status reports RUNNING for a few seconds. What does not happen is any cell executing. The help text and docs say it that way rather than promising that nothing runs at all.

Related

Fixes #493

Every push queues a full execution, so correcting a typo in a markdown cell
means re-running the whole notebook. The web UI has this under Save Version as
Quick Save, and the API already supports it: ApiSaveKernelRequest carries
kernel_execution_type, and KernelExecutionType.QUICK_SAVE is in the pinned
kagglesdk. The CLI never set the field, so the server always saved and ran.

Add --no-run, which sets the field to QUICK_SAVE and leaves the default
untouched. The success message no longer points at run progress in that case,
because nothing is running.

Verified against the live API by pushing the same notebook twice. With --no-run
the version settled in 24 seconds and its log contains none of the notebook's
own output. Without it the same notebook ran for 60 seconds and the log contains
its print exactly once.

Fixes Kaggle#493
@sridipbasu sridipbasu added the enhancement New feature or request label Aug 28, 2026
@sridipbasu

Copy link
Copy Markdown
Collaborator

I have taken a look at this change with the upcoming LRO work in mind. Most probably there is no conflict as it is limited to the existing QUICK_SAVE request behavior and does not include any client side polling, waiting or progress handling that LRO would replace.

The default kernels push path also remains unchanged, so from that perspective it looks safe.
LGTM!

CC: @stevemessick

@stevemessick

Copy link
Copy Markdown
Contributor

/gcbrun

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Push kernel but don't run it

3 participants