07 Wait For Metrics Processing

Step 7: Wait For Metrics Processing

Poll GET /ingestions/{{plot_lifecycle_metrics_task_id}} until the processBatchStats job dispatched in step 6 reaches a terminal state โ€” completed (or completed_with_errors / failed). Retries are bounded by {{plot_lifecycle_metrics_poll_retries}}.

What this step does

It watches the metric job to completion. Note the terminal set differs from step 2: staging has no meaning here, so this step waits specifically for completed / completed_with_errors / failed โ€” the states that mean the deforestation aggregates have finished computing (or definitively didn't).

Why it's needed

Metric processing is asynchronous, so step 6 returns before the numbers exist. Querying /metrics/plots/deforestation (step 8) before the job finishes would return empty or partial results. This step is the gate that guarantees the aggregates are ready before you read them, and โ€” via failed โ€” tells you when they won't arrive so you don't poll step 8 forever.

Next Step

โ†’ Step 8: Get Plot Deforestation Metrics โ€” read the finished deforestation series.