mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-05 10:55:29 +00:00
Add a calendar-driven scheduler so a user can pick a model in Cookbook, click "Schedule…" instead of "Launch", choose time windows + days of the week + (optional) end date, and have Odysseus auto-launch the serve when the window starts and hard-kill it when the window ends. The calendar IS the source of truth — events on a designated calendar are interpreted as serve schedules, so editing the event in the calendar UI immediately changes the schedule.
Whole feature is gated by setting `cookbook_scheduler_enabled` (default False). Disabling the setting silences the reconciler and the API refuses requests; setting + three new files = entire surface, easy to revert.
New files:
- src/cookbook_scheduler.py — background reconciler: ticks every 60s, reads next ±90s of calendar events on the designated calendar, launches/kills serves to match. Honors "refuse if GPUs busy" (skips with reason, no retry). Adopts pre-existing manual serves matching the event's model so window-end cleanup still applies. Tags scheduler-owned tasks with `_scheduledBy: <event_uid>` so it never kills serves it doesn't own.
- routes/cookbook_schedule_routes.py — POST /api/cookbook/schedule/from-cookbook builds RRULE+ICS events from the modal's input (model, slots[], days[], until). GET /upcoming returns the next 24h with per-event status (scheduled / running / adopted / skipped / failed / ended) for the UI. POST /reconcile-now manually kicks the reconciler.
- static/js/cookbookSchedule.js — Schedule button click handler + modal. Daily/hourly time slot picker, multi-slot ("+ add another time slot"), weekday chips with Weekdays/Weekend/Every-day quicksets, optional Until date. Calls /from-cookbook on save. Whole module is a single IIFE; deleting the file plus its <script> tag removes the UI surface.
Existing files touched (minimal):
- app.py: register the new router + add the reconcile loop as a startup task (~10 lines, all in one block). Reconcile loop checks the feature flag on every tick, so leaving it running with the flag off costs ~one settings lookup per minute.
- static/index.html: one new <script> tag for cookbookSchedule.js.
- static/js/cookbookServe.js: add a "Schedule…" button next to the existing Launch button. Hidden by default; cookbookSchedule.js reveals it after confirming the feature flag is on.
- static/style.css: ~80 lines for the modal styles (mobile-aware via @media).
User choices baked in:
- Calendar events are the source of truth.
- Refuse to launch if GPUs busy (skip + log reason in scheduler.events[uid].reason).
- Hard kill at event end.
- No retry on a skipped event within the window.
- Multi-slot per day supported (one calendar event per slot, shared RRULE).
- Pre-existing manual serves get adopted at window start so they're killed at end.
Known follow-ups (not in this commit):
- Settings UI to pick the schedule calendar + toggle the feature flag.
- Calendar event color/badge for status (running/skipped/failed).
- "Lazy launch on first request" — currently launches at event start. Replacing _launch_serve with a proxy that defers vllm until the first chat request is a contained future change.
|
||
|---|---|---|
| .. | ||
| search | ||
| action_intents.py | ||
| agent_loop.py | ||
| agent_runs.py | ||
| agent_tools.py | ||
| ai_interaction.py | ||
| api_key_manager.py | ||
| app_helpers.py | ||
| app_initializer.py | ||
| assistant_log.py | ||
| auth_helpers.py | ||
| bg_jobs.py | ||
| bg_monitor.py | ||
| builtin_actions.py | ||
| builtin_mcp.py | ||
| caldav_sync.py | ||
| caldav_writeback.py | ||
| chat_handler.py | ||
| chat_helpers.py | ||
| chat_processor.py | ||
| chroma_client.py | ||
| cleanup_service.py | ||
| config.py | ||
| constants.py | ||
| context_budget.py | ||
| context_compactor.py | ||
| cookbook_scheduler.py | ||
| database.py | ||
| deep_research.py | ||
| document_actions.py | ||
| document_processor.py | ||
| email_thread_parser.py | ||
| embeddings.py | ||
| endpoint_resolver.py | ||
| event_bus.py | ||
| exceptions.py | ||
| goal_based_extractor.py | ||
| integrations.py | ||
| llm_core.py | ||
| markitdown_runtime.py | ||
| mcp_manager.py | ||
| memory.py | ||
| memory_vector.py | ||
| model_context.py | ||
| model_discovery.py | ||
| pdf_form_doc.py | ||
| pdf_forms.py | ||
| pdf_runtime.py | ||
| personal_docs.py | ||
| preset_manager.py | ||
| prompt_security.py | ||
| rag_manager.py | ||
| rag_singleton.py | ||
| rag_vector.py | ||
| rate_limiter.py | ||
| readiness.py | ||
| request_models.py | ||
| research_handler.py | ||
| research_utils.py | ||
| secret_storage.py | ||
| session_actions.py | ||
| settings.py | ||
| settings_scrub.py | ||
| task_endpoint.py | ||
| task_scheduler.py | ||
| teacher_escalation.py | ||
| text_helpers.py | ||
| tool_execution.py | ||
| tool_implementations.py | ||
| tool_index.py | ||
| tool_parsing.py | ||
| tool_schemas.py | ||
| tool_security.py | ||
| topic_analyzer.py | ||
| upload_handler.py | ||
| upload_limits.py | ||
| url_safety.py | ||
| url_security.py | ||
| visual_report.py | ||
| webhook_manager.py | ||
| youtube_handler.py | ||