Skip to content

Expose aggregate submission queue status#503

Closed
msaroufim wants to merge 1 commit into
mainfrom
queue-status-metadata
Closed

Expose aggregate submission queue status#503
msaroufim wants to merge 1 commit into
mainfrom
queue-status-metadata

Conversation

@msaroufim

Copy link
Copy Markdown
Member

Summary

Adds aggregate submission queue metadata to KernelBot background submissions without exposing other users' identities or submission IDs.

The API now returns a queue object on submission acceptance and on user submission polling. It includes the caller's position, jobs ahead, pending/running counts, worker counts, and a flag clarifying that external runner queues are not visible.

Why

Users can see whether they are waiting in KernelBot's in-process queue versus waiting on runner execution, while avoiding disclosure of who else is queued.

Validation

  • uv run --with pytest --with pytest-asyncio pytest tests/test_background_submission_manager.py tests/test_admin_api.py

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/libkernelbot
  background_submission_manager.py
  utils.py
Project Total  

This report was generated by python-coverage-comment-action

@msaroufim

Copy link
Copy Markdown
Member Author

Additional local e2e validation after opening the PR:

  • Ran a local FastAPI KernelBot harness on 127.0.0.1:8766 using the real BackgroundSubmissionManager and a fake runner/DB.
  • Preloaded one pending job, held workers at 0, submitted a second job through the actual popcorn-cli binary over HTTP, then released workers.
  • CLI output included:
Submission 1001 accepted (kernelbot queue position 2, 1 ahead; 2 pending, 0 running, workers 0/0; runner queue not visible). Waiting for results...
Submission 1001 status: pending (kernelbot queue position 2, 1 ahead; 2 pending, 0 running, workers 0/0; runner queue not visible, 0s)
Submission 1001 status: pending (kernelbot queue position 2, 1 ahead; 2 pending, 0 running, workers 0/0; runner queue not visible, 5s)
Submission 1001 status: succeeded (kernelbot queue: 0 pending, 0 running, workers 2/2; runner queue not visible, 10s)

This verifies the API response shape and CLI display path end to end without invoking Modal/GitHub.

@msaroufim msaroufim force-pushed the queue-status-metadata branch from cc4eeaa to 02f454d Compare June 25, 2026 05:32
@msaroufim

Copy link
Copy Markdown
Member Author

Updated after simplifying the queue status shape.

Local e2e validation with a real HTTP path still passes:

  • Ran a local FastAPI KernelBot harness on 127.0.0.1:8766 using the real BackgroundSubmissionManager and a fake runner/DB.
  • Preloaded one pending job, held workers at 0, submitted a second job through the actual popcorn-cli binary over HTTP, then released workers.
  • CLI output now uses the simplified messages:
Submission 1001 accepted: In KernelBot queue (position 2, 1 ahead). Waiting for results...
Submission 1001 status: pending - In KernelBot queue (position 2, 1 ahead) (0s)
Submission 1001 status: succeeded - Job dispatched to Modal/GitHub runner (5s)

The public queue payload is now limited to stage, message, and optional position / jobs_ahead.

@msaroufim

Copy link
Copy Markdown
Member Author

Closing this draft; queue-position metadata does not answer the more useful wait-time/debugging question.

@msaroufim msaroufim closed this Jun 25, 2026
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.

1 participant