Skip to contents

Chunks land over hours, and pooling whatever is on disk mid-run is a reasonable thing to want. The hazard is that a partial pool produces a report that is wrong in no visible way: every health check passes, every frequency is honestly computed, and only the denominator is not the intended one.

Usage

boot_shortfall(bag, expect_chunks, expect_boot)

Arguments

bag

A pooled object from boot_pool_chunks(), or a single run.

expect_chunks

How many chunks were launched.

expect_boot

How many replicates were wanted in total.

Value

NULL when the pool is the run that was launched; otherwise a sentence saying how it falls short, suitable for a callout.

Details

The expected totals are the only thing that can catch it, and they must come from outside the chunks — nothing in a chunk knows how many siblings it was launched alongside.

Replicates are checked as well as chunks, because a chunk that ran short is not a missing chunk and counting chunks alone would call that complete. An over-count is reported too: it means either the expectation is stale or a stray chunk from another run is being pooled, and both are worth saying.

Examples

# Two chunks as the hazard runner writes them: same screen, different seeds.
chunk <- function(seed) list(
  seed = seed, n_boot = 2L, slentry = 0.1, slstay = 0.05,
  base_params = "early.log_mu", usable = c(early = 10L), max_steps = 50L,
  elapsed_mins = 1, manifest = list(sha256 = "example"),
  th_version = "1.2.16",
  boot = list(n_success = 2L, n_failed = 0L, replicates = data.frame(
    replicate = c(1L, 1L, 2L), parameter = c("early.log_mu", "early.age",
    "early.log_mu"), estimate = c(0.1, 0.02, 0.2)))
)
pooled <- boot_pool_chunks(list(chunk(1), chunk(2)))

# The run that was launched: NULL.
boot_shortfall(pooled, expect_chunks = 2, expect_boot = 4)
#> NULL

# A third chunk has not landed yet.
boot_shortfall(pooled, expect_chunks = 3, expect_boot = 6)
#> [1] "This screen pooled 2 of 3 chunks and 4 of 6 replicates. The frequencies below are provisional: they are computed over the replicates present, not over the run that was launched. Re-render once the remaining chunks land."