diff --git a/internal/scheduler/hub.go b/internal/scheduler/hub.go index 0fb0498..36ad5d3 100644 --- a/internal/scheduler/hub.go +++ b/internal/scheduler/hub.go @@ -270,7 +270,7 @@ func (h *SchedulerHub) HandleConnection(w http.ResponseWriter, r *http.Request) // Check if this is a metrics client (special token prefix) if strings.HasPrefix(clientID, "metrics-") { - go h.runMetricsClient(clientID, conn) + go h.runMetricsClient(conn) return } @@ -447,30 +447,6 @@ func (h *SchedulerHub) canAdmit(candidate *Task, worker *WorkerConn) bool { return worker.capabilities.GPUCount >= candidate.Spec.GPUCount } -// canRequeue checks if a task can be re-queued based on wall-clock elapsed time. -// Returns false if the task has exceeded its MaxRuntime budget. -func (h *SchedulerHub) canRequeue(task *Task) bool { - if task.FirstAssignedAt.IsZero() { - return true // Never assigned, can always re-queue - } - - elapsed := time.Since(task.FirstAssignedAt) - maxRuntime := task.MaxRuntime - if maxRuntime == 0 { - maxRuntime = 24 * time.Hour // Default 24h - } - - if elapsed > maxRuntime { - // Task exceeded wall-clock budget - fail it - slog.Info("task exceeded max runtime, failing", - "task_id", task.ID, - "elapsed", elapsed, - "max_runtime", maxRuntime) - return false - } - return true -} - func (h *SchedulerHub) assignTask(task *Task, wc *WorkerConn) Message { // Remove from queue first (prevent double-assignment) h.batchQueue.Remove(task.ID) @@ -880,7 +856,7 @@ func (h *SchedulerHub) sendPrewarmHint(task *Task) { } // runMetricsClient handles metrics clients over WSS -func (h *SchedulerHub) runMetricsClient(clientID string, conn *websocket.Conn) { +func (h *SchedulerHub) runMetricsClient(conn *websocket.Conn) { defer conn.Close() for { diff --git a/internal/scheduler/plugin_quota.go b/internal/scheduler/plugin_quota.go index 605fd4b..49c7d05 100644 --- a/internal/scheduler/plugin_quota.go +++ b/internal/scheduler/plugin_quota.go @@ -274,14 +274,3 @@ func (m *PluginQuotaManager) getUserLimit(userID string) UserLimit { MaxServices: m.config.PerUserServices, } } - -// getUsageLocked returns the current usage for a user-plugin combination. -// Must be called with read lock held. -func (m *PluginQuotaManager) getUsageLocked(userID, pluginName string) PluginUsage { - if userPlugins, ok := m.usage[userID]; ok { - if usage, ok := userPlugins[pluginName]; ok { - return usage - } - } - return PluginUsage{} -}