Fix stat card dotted border, use job queue counts for progress
This commit is contained in:
parent
4999548a0c
commit
fa5fabe02e
1 changed files with 20 additions and 14 deletions
|
|
@ -94,27 +94,33 @@ defmodule MicrowavepropWeb.BackfillLive do
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
missing_hrrr =
|
# Use Oban job counts as proxy for in-progress work since queued flags
|
||||||
|
# only indicate "was enqueued" not "data exists"
|
||||||
|
pending_hrrr =
|
||||||
Repo.one(
|
Repo.one(
|
||||||
from(c in Contact,
|
from(j in "oban_jobs",
|
||||||
where: not is_nil(c.pos1) and c.hrrr_queued == false,
|
where:
|
||||||
select: count(c.id)
|
j.worker == "Microwaveprop.Workers.HrrrFetchWorker" and
|
||||||
|
j.state in ["available", "executing", "scheduled", "retryable"],
|
||||||
|
select: count(j.id)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
missing_weather =
|
pending_weather =
|
||||||
Repo.one(
|
Repo.one(
|
||||||
from(c in Contact,
|
from(j in "oban_jobs",
|
||||||
where: not is_nil(c.pos1) and c.weather_queued == false,
|
where:
|
||||||
select: count(c.id)
|
j.worker == "Microwaveprop.Workers.WeatherFetchWorker" and
|
||||||
|
j.state in ["available", "executing", "scheduled", "retryable"],
|
||||||
|
select: count(j.id)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
terrain: missing_terrain,
|
terrain: missing_terrain,
|
||||||
hrrr: missing_hrrr,
|
hrrr: pending_hrrr,
|
||||||
weather: missing_weather,
|
weather: pending_weather,
|
||||||
total: max(missing_terrain, max(missing_hrrr, missing_weather))
|
total: missing_terrain + pending_hrrr + pending_weather
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -168,7 +174,7 @@ defmodule MicrowavepropWeb.BackfillLive do
|
||||||
</.header>
|
</.header>
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 my-6">
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 my-6">
|
||||||
<div class="stat bg-base-200 rounded-box p-4">
|
<div class="bg-base-200 rounded-box p-4">
|
||||||
<div class="text-xs opacity-60">Enrichment Progress</div>
|
<div class="text-xs opacity-60">Enrichment Progress</div>
|
||||||
<div class="text-2xl font-bold">{@unprocessed.total} remaining</div>
|
<div class="text-2xl font-bold">{@unprocessed.total} remaining</div>
|
||||||
<div class="text-xs opacity-60 mt-1">
|
<div class="text-xs opacity-60 mt-1">
|
||||||
|
|
@ -185,13 +191,13 @@ defmodule MicrowavepropWeb.BackfillLive do
|
||||||
<span>Weather: {@unprocessed.weather}</span>
|
<span>Weather: {@unprocessed.weather}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat bg-base-200 rounded-box p-4">
|
<div class="bg-base-200 rounded-box p-4">
|
||||||
<div class="text-xs opacity-60">Active/Queued Jobs</div>
|
<div class="text-xs opacity-60">Active/Queued Jobs</div>
|
||||||
<div class="text-2xl font-bold">
|
<div class="text-2xl font-bold">
|
||||||
{Enum.reduce(@stats.by_worker, 0, fn w, acc -> acc + w.total end)}
|
{Enum.reduce(@stats.by_worker, 0, fn w, acc -> acc + w.total end)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat bg-base-200 rounded-box p-4">
|
<div class="bg-base-200 rounded-box p-4">
|
||||||
<div class="text-xs opacity-60">Completed (last hour)</div>
|
<div class="text-xs opacity-60">Completed (last hour)</div>
|
||||||
<div class="text-2xl font-bold">{@stats.completed_1h}</div>
|
<div class="text-2xl font-bold">{@stats.completed_1h}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue