prop/lib/microwaveprop/workers/pskr_recalibration_worker.ex
Graham McIntire ea3033da03
chore: update to elixir 1.20 / otp 29, fix compile warnings
- Update .tool-versions to elixir 1.20.0-otp-29 / erlang 29.0.1
- Update all hex dependencies
- Remove unused aliases in path_compute.ex and rover_planning_live/show.ex
- Fix Oban unique states to include :suspended (use :incomplete group)
2026-06-03 14:34:39 -05:00

35 lines
1 KiB
Elixir

defmodule Microwaveprop.Workers.PskrRecalibrationWorker do
@moduledoc """
Weekly cron that runs `Pskr.Recalibrator` against the
PSKR calibration corpus.
Scheduled for Sunday 04:00 UTC (off-peak, after the climatology
rebuild and before the Monday-morning operator review window). At
fire time the recalibrator decides whether the corpus is dense
enough to bin — when it isn't, the run still records a row with
status `"skipped_insufficient_data"` so the audit trail captures
every fire.
Manual reruns: enqueue this worker with no args. It always
produces a fresh run record; previous runs stay queryable for
trend comparison.
"""
use Oban.Worker,
queue: :backfill_enqueue,
max_attempts: 3,
unique: [
period: 86_400,
states: :incomplete
]
alias Microwaveprop.Pskr.Recalibrator
require Logger
@impl Oban.Worker
def perform(%Oban.Job{}) do
run = Recalibrator.run()
Logger.info("PskrRecalibrationWorker: status=#{run.status} sample_count=#{run.sample_count}")
:ok
end
end