Skip to content

Add admin CLI commands#29

Merged
msaroufim merged 5 commits intomainfrom
feature/admin-cli-commands
Feb 1, 2026
Merged

Add admin CLI commands#29
msaroufim merged 5 commits intomainfrom
feature/admin-cli-commands

Conversation

@msaroufim
Copy link
Member

@msaroufim msaroufim commented Feb 1, 2026

Summary

Add admin subcommands to the CLI for managing the kernelbot server.

New Commands

popcorn admin start              # Start accepting jobs
popcorn admin stop               # Stop accepting jobs  
popcorn admin stats              # View server statistics
popcorn admin stats --last-day   # Stats for last 24 hours only
popcorn admin get-submission ID  # Get submission details
popcorn admin delete-submission ID  # Delete a submission
popcorn admin delete-leaderboard NAME [--force]

Authentication

Requires POPCORN_ADMIN_TOKEN environment variable:

export POPCORN_ADMIN_TOKEN=your_token_here
popcorn admin stats

Usage with Local Server

export POPCORN_API_URL=http://127.0.0.1:8000
export POPCORN_ADMIN_TOKEN=your_local_token
popcorn admin start

Changes

  • src/cmd/admin.rs: New admin command module
  • src/cmd/mod.rs: Added Admin command variant and handler
  • src/service/mod.rs: Added admin HTTP functions with Bearer token auth

Test plan

  • popcorn admin --help shows available commands
  • Commands work with valid token
  • Commands fail gracefully without token (helpful error message)
  • Commands fail with invalid token (401 error)

- Add admin subcommand with start, stop, stats, and CRUD operations
- Add admin service functions with Bearer token authentication
- New commands:
  - popcorn admin start/stop - control job acceptance
  - popcorn admin stats - view server statistics
  - popcorn admin get-submission/delete-submission
  - popcorn admin create-leaderboard/delete-leaderboard

Requires POPCORN_ADMIN_TOKEN environment variable for authentication.
- Only require directory as positional arg (e.g., "identity_py")
- Accept --gpu multiple times for multiple GPU types
- Name and deadline auto-derived by server
- Remove --gpu argument (GPUs now come from task.yml)
- Remove unimplemented LoadCompetition stub
- Service only sends directory in payload
@msaroufim
Copy link
Member Author

Also @ngc92 - not sure why i cant tag

Adds CLI support for updating problems from a GitHub repository,
mirroring the Discord /admin update-problems command. Supports
--problem-set, --repository, --branch, and --force options.
Copy link
Member

@S1ro1 S1ro1 left a comment

Choose a reason for hiding this comment

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

lgtm 🔥

Removed 'almost' from the description of CLI capabilities.
@msaroufim msaroufim merged commit 297253f into main Feb 1, 2026
4 checks passed
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.

2 participants