Skip to content

feat(competitions): add submission status command and --wait support#1139

Open
sridipbasu wants to merge 1 commit into
Kaggle:mainfrom
sridipbasu:feat/competition-submit-wait
Open

feat(competitions): add submission status command and --wait support#1139
sridipbasu wants to merge 1 commit into
Kaggle:mainfrom
sridipbasu:feat/competition-submit-wait

Conversation

@sridipbasu

Copy link
Copy Markdown
Contributor

Summary

This PR improves the competition submission workflow by adding support for waiting on a submission to finish scoring and by exposing submission details through a new CLI command.

What's changed

  • kaggle competitions submit now prints the submission reference after a successful submission.
  • Added --wait [SECONDS] to wait until a submission finishes scoring and print the public score.
  • Added --poll-interval to control the maximum polling interval while waiting.
  • Added a new command:
kaggle competitions submission <ref>

to view the status and details of a single submission.

Why?

Currently, after submitting to a competition, the CLI exits immediately and doesn't expose the submission reference returned by the backend. Although the SDK already provides a get_submission() API, there isn't a CLI command that uses it.

This makes it difficult to automate competition workflows or use the CLI in CI pipelines since users have to repeatedly check kaggle competitions submissions and identify the correct submission manually.

This PR exposes the existing SDK functionality through the CLI without requiring any backend changes.

Example

$ kaggle competitions submit -c titanic -f submission.csv -m "CI run" --wait

Submission ref: 12345678
Submission status: PENDING...
Submission status: PENDING...
Submission scored. Public score: 0.78468
$ kaggle competitions submission 12345678

Submission Ref: 12345678
Status: COMPLETE
Public Score: 0.78468
Description: CI run

Implementation

  • Added a dedicated submission polling helper.
  • Reused the existing retry and adaptive polling utilities.
  • Added handling for scoring errors, timeouts, retries, and temporary 404 responses immediately after submission.
  • Added documentation and CLI help for the new options and command.

Testing

  • Added unit tests covering parser behavior, polling, timeout handling, scoring failures, retries, and the new command.

  • Ran the full test suite.

  • Verified the feature against the live Kaggle API by:

    • submitting a competition entry,
    • retrieving it using the returned submission reference,
    • waiting until scoring completed,
    • and confirming the public score was displayed correctly.

Backward compatibility

Without --wait, the existing submission workflow behaves as before. The only visible change is that the submission reference is now printed after a successful submission.

@sridipbasu

Copy link
Copy Markdown
Contributor Author

Attaching a few screenshots from testing this locally against a live Kaggle competition. I verified the new CLI options, successful submission, submission lookup using the returned ref, and the --wait workflow until scoring completed.

image image

@stevemessick

Copy link
Copy Markdown
Contributor

/gcbrun

"""
if kernel and not version or version and not kernel:
raise ValueError("Code competition submissions require both the output file name and the version number")
if wait is not None and poll_interval <= 0:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

to avoid ddosing ourselves, there should be a sane minimum poll interval

start_time = time.time()
current_interval = min(self._ADAPTIVE_POLL_START, poll_interval)
try:
while True:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Given a max notebook runtime of 12 hours, this should wait a maximum of 12 hours before exiting

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