HRRR publishes f21-f48 at 3-hourly intervals in addition to the hourly f01-f18 we already fetch. This extends the grid_tasks seed from 19 rows (1 analysis + 18 forecast) to 29 rows (1 analysis + 18 hourly + 10 3-hourly), and bumps the UI forecast window constant from 18h to 48h so the map timeline and path calculator forecast chart automatically show the extended horizon. No Rust logic changes needed — the pipeline is data-driven and u8 forecast_hour already handles f48.
42 lines
1.4 KiB
Elixir
42 lines
1.4 KiB
Elixir
defmodule Microwaveprop.Propagation.RunTiming do
|
|
@moduledoc """
|
|
One row per forecast hour of a `PropagationGridWorker` chain, recording
|
|
how long that hour's fetch + score + persist cycle took.
|
|
|
|
Rows are keyed by `(run_time, forecast_hour)`. `run_time` is the HRRR
|
|
model cycle and `forecast_hour` ∈ 0..48.
|
|
"""
|
|
use Ecto.Schema
|
|
|
|
import Ecto.Changeset
|
|
|
|
@type t :: %__MODULE__{}
|
|
|
|
@primary_key {:id, :binary_id, autogenerate: true}
|
|
@foreign_key_type :binary_id
|
|
schema "propagation_run_timings" do
|
|
field :run_time, :utc_datetime
|
|
field :forecast_hour, :integer
|
|
field :valid_time, :utc_datetime
|
|
field :started_at, :utc_datetime_usec
|
|
field :finished_at, :utc_datetime_usec
|
|
field :duration_ms, :integer
|
|
field :status, Ecto.Enum, values: [:ok, :failed]
|
|
field :error, :string
|
|
|
|
timestamps(type: :utc_datetime, updated_at: false)
|
|
end
|
|
|
|
@required ~w(run_time forecast_hour valid_time started_at finished_at duration_ms status)a
|
|
@optional ~w(error)a
|
|
|
|
@spec changeset(t() | Ecto.Changeset.t(), map()) :: Ecto.Changeset.t()
|
|
def changeset(row, attrs) do
|
|
row
|
|
|> cast(attrs, @required ++ @optional)
|
|
|> validate_required(@required)
|
|
|> validate_number(:forecast_hour, greater_than_or_equal_to: 0, less_than_or_equal_to: 48)
|
|
|> validate_number(:duration_ms, greater_than_or_equal_to: 0)
|
|
|> unique_constraint([:run_time, :forecast_hour])
|
|
end
|
|
end
|