- Add jump_credo_checks ~> 0.4 with all 20 checks enabled - Fix all standard Credo issues: 139 @spec (113 done, 26 remain), 4 refactoring, 3 alias usage, 9 System.cmd env, 5 unsafe_to_atom, 2 max line length, 9 assert_receive timeout - Fix 170+ jump_credo_checks warnings: - 117 TopLevelAliasImportRequire: move nested alias/import to module top - 32 UseObanProWorker: switch to Oban.Pro.Worker - 4 DoctestIExExamples: add doctests / create test file - ~20 WeakAssertion: strengthen type-check assertions - Various ConditionalAssertion, AssertReceiveTimeout fixes - Exclude vendor/ from Credo analysis - Remaining: 175 warnings (mostly opinionated WeakAssertion, AvoidSocketAssignsInTest), 26 @spec annotations
35 lines
1 KiB
Elixir
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.Pro.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
|