Class CleanupEtaUtil
The estimate is deliberately based on the throughput observed SINCE THIS RUN STARTED, not since the campaign started: a resumed worker must not inherit the throughput of the run that was interrupted (a machine that was slow yesterday says nothing about today's remaining time). It is CUMULATIVE over that run and not windowed — it was once described here as 'rolling', which it never was.
UNIT-AGNOSTIC on purpose: the arithmetic is 'work done over time elapsed', and
the caller chooses what a unit of work is. The scan counts NODES, whose cost is
near-uniform. The purge counts BYTES (CleanupExecutionService#purgeEtaSeconds),
because its items differ in cost by orders of magnitude and a count-based
average predicts the items already met rather than the ones left.
-
Method Summary
Modifier and TypeMethodDescriptionstatic longcomputeEtaSeconds(long startTime, long processedAtStart, long processed, long total) Same ascomputeEtaSeconds(long, long, long, long, long)evaluated against the current server clock.static longcomputeEtaSeconds(long startTime, long processedAtStart, long processed, long total, long nowMillis) Remaining time of a run, from the throughput measured since it started.
-
Method Details
-
computeEtaSeconds
public static long computeEtaSeconds(long startTime, long processedAtStart, long processed, long total) Same ascomputeEtaSeconds(long, long, long, long, long)evaluated against the current server clock.- Parameters:
startTime- epoch millis at which THIS run startedprocessedAtStart- work already done when this run started (a resumed worker starts above zero)processed- work done so far, includingprocessedAtStarttotal- denominator of the run, in the SAME unit- Returns:
- estimated remaining seconds, 0 when it cannot be estimated yet
-
computeEtaSeconds
public static long computeEtaSeconds(long startTime, long processedAtStart, long processed, long total, long nowMillis) Remaining time of a run, from the throughput measured since it started. Short-circuits to 0 — 'unknown', never a negative or infinite value — whenever the throughput isn't measurable yet: no time elapsed, or nothing processed since the run started (the very first batch of a resumed worker). A numerator that already reached (or passed) the denominator also yields 0.- Parameters:
startTime- epoch millis at which THIS run startedprocessedAtStart- items already processed when this run startedprocessed- items processed so far, includingprocessedAtStarttotal- denominator of the runnowMillis- evaluation time (epoch millis)- Returns:
- estimated remaining seconds, 0 when it cannot be estimated yet
-