class ActivityController
The βwhat is happening right nowβ screen: engine state, executions running, awaiting a commit-conflict retry, and queued.
Public Instance Methods
Source
# File app/controllers/activity_controller.rb, line 47 def cancel_query authorize :activity, :cancel_query? TrinoProvisioner.cancel_query(params[:query_id]) ActivityBroadcaster.broadcast! redirect_to activity_path, notice: t("activity.notices.query_cancelled") end
Cancels a running or queued Trino query on the coordinator.
Source
# File app/controllers/activity_controller.rb, line 40 def hard_reset authorize :activity, :hard_reset? TrinoEngineSupervisor.hard_reset! redirect_to activity_path, notice: t("activity.notices.hard_reset") end
Forcibly tears down a frozen engine: fails in-flight work, clears the queue, and scales the Trino cluster down. Redirects back to the activity screen.
Source
# File app/controllers/activity_controller.rb, line 32 def restart authorize :activity, :restart? TrinoEngineSupervisor.restart! redirect_to activity_path, notice: t("activity.notices.restart") end
Re-triggers the engine start through the supervisor and redirects back to the activity screen.
Source
# File app/controllers/activity_controller.rb, line 6 def show authorize :activity, :show? @engine_state = TrinoEngineSupervisor.state @running = ExecutionHistory.includes(:iceberg_table, :execution_steps, maintenance_plan: :maintenance_steps) .where(status: "running") .order(:created_at) plan_ids = @running.map(&:maintenance_plan_id).compact.uniq @typical_durations = MaintenancePlan.typical_durations_for(plan_ids) @queued = ExecutionHistory.includes(:iceberg_table) .where(status: "pending") .order(:created_at) @queries = TrinoProvisioner.safe_active_queries @queue = QueueSummary.new.call @engine_events = ErrorEvent.where(source_system: "engine", operation: "engine-lifecycle") .order(last_seen_at: :desc) .limit(20) # "Nothing needs the engine right now" is a different state from "stuck at # the first stage", and it is the one seen most often. Read it from the # execution/run tables directly - NOT through TrinoDemand, whose #count # calls reap_orphans! and would mutate execution state on a page render. @engine_idle = @engine_state.status == "down" && @running.empty? && @queued.empty? end
Shows the live engine state, running executions, queued executions, active Trino queries, the Solid Queue backlog, and the recent engine lifecycle.