Batch Progress¶
The /batch_progress endpoint provides real-time progress tracking for batch processing operations. It allows you to monitor the status of both /batch_process and /batch_supply_shed operations by querying their tracking IDs.
This endpoint is essential for monitoring long-running batch operations, as these processes are asynchronous and can take significant time to complete depending on the number of plots or facilities being processed.
Overview¶
The /batch_progress endpoint returns different response types depending on the type of batch operation:
BatchProcessProgress: For/batch_processoperationsBatchSupplyShedProgress: For/batch_supply_shedoperations
Both response types provide detailed information about the current status, completion percentage, and any failures that may have occurred.
Parameters¶
Query Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
tracking_id |
string | Yes* | - | The tracking ID (collection_id) of the batch processing operation |
tracking_ids |
list[string] | Yes* | - | A list of tracking IDs for batch supply shed operations. Only supports batch supply shed tracking IDs and concatenates to a single progress object |
filename |
string | No | - | Deprecated: Use tracking_id instead. The original filename submitted during batch_process, or the collection_id/tracking_id of the batch process/supply shed operation |
dummy_data |
boolean | No | false |
Whether to return dummy data for testing (not exposed in API schema) |
* Exactly one of tracking_id, tracking_ids, or filename must be provided.
Getting the Tracking ID¶
The tracking ID is returned in the response when you submit a batch operation:
/batch_process: Returns task IDs and collection metadata/batch_supply_shed: Returns facility tracking IDs and collection metadata
You can also retrieve tracking IDs from:
- The response of the initial batch operation submission
- The /get_collections endpoint
- The /get_task_status endpoint
Response Types¶
BatchProcessProgress¶
Returned for /batch_process operations. Provides stage-based progress information.
{
"n_stages": 4,
"stage": 2,
"progress": 50,
"failed": false,
"complete": false,
"overall_progress": 37
}
Fields¶
| Field | Type | Description |
|---|---|---|
n_stages |
integer | Total number of stages in the batch process (typically 4) |
stage |
integer | Current stage number (1 to n_stages) |
progress |
integer | Progress percentage for the current stage (0-100) |
failed |
boolean | Whether the batch process has failed |
complete |
boolean | Whether the batch process has completed successfully |
overall_progress |
integer | Overall progress percentage across all stages (0-100) |
skip_reason |
string | null | Optional reason for skipping processing (e.g., "low - not processed" for low confidence). Included in progress response whether the batch run is complete or not. |
Stages¶
The batch process consists of 4 stages:
- start_batch_process: Initial batch process setup and initialization
- start_zonal_stats: Beginning zonal statistics computation for environmental metrics
- ingest_images_orchestration: Orchestrating satellite image ingestion
- orchestrate_ingestion: Final orchestration step for completing ingestion and table finalization
BatchSupplyShedProgress¶
Returned for /batch_supply_shed operations. Provides facility-based progress information.
Note: Unlike BatchProcessProgress, BatchSupplyShedProgress does not use the n_stages concept. Instead, it tracks progress by counting facilities in different processing states. Batch supply shed operations go through 7 processing flows (compared to 4 stages for batch process), but these are tracked as facility counts rather than stage-based progress.
{
"complete": false,
"total_number_of_facilities": 100,
"total_number_of_ungeocoded_facilities": 5,
"total_number_of_facilities_failed": 3,
"total_number_of_facilities_completed": 92,
"total_number_of_facilities_queued": 0,
"total_number_of_facilities_preprocessing": 0,
"total_number_of_facilities_processing": 0
}
Fields¶
| Field | Type | Description |
|---|---|---|
complete |
boolean | Whether all facilities have completed processing (including failures) |
total_number_of_facilities |
integer | Total number of facilities submitted for processing |
total_number_of_ungeocoded_facilities |
integer | Number of facilities that failed to geocode and won't be processed |
total_number_of_facilities_failed |
integer | Number of facilities that have failed in any part of the process (including geocoding failures) |
total_number_of_facilities_completed |
integer | Number of facilities that have completed the process successfully (doesn't include failures) |
total_number_of_facilities_queued |
integer | Number of facilities queued to be processed |
total_number_of_facilities_preprocessing |
integer | Number of facilities in the pre-processing stage (start-batch-supply-shed → detect-plots → export_vectors) |
total_number_of_facilities_processing |
integer | Number of facilities in the processing stage (complete-detect-plots → start-zonal-stats → ingest_images → complete-zonal-stats → check-tables) |
skip_reason |
string | null | Optional reason for skipping processing (e.g., "low - not processed" for low confidence). Included in progress response whether the batch run is complete or not. |
Facility Processing Flows¶
Facilities progress through 7 processing flows (more than the 4 stages in batch process):
- Queued: Facility is waiting to start processing (not yet started any flow)
- Preprocessing (4 flows):
start_batch_supply_shed: Initial batch supply shed setupdetect_plots: Plot detection and discretizationexport_vectors_orchestration: Exporting plot geometriescomplete_detect_plots: Finalizing plot detection- Processing (3 flows):
start_zonal_stats: Beginning zonal statistics computationingest_images_orchestration: Orchestrating satellite image ingestionorchestrate_ingestion: Final orchestration step for completing ingestion- Completed: Facility processing finished successfully (completed the final orchestration step)
- Failed: Facility processing encountered an error at any flow
Total: 7 flows for batch supply shed vs 4 stages for batch process
Usage Examples¶
Python¶
Check Progress for Batch Process¶
Check Progress for Batch Supply Shed¶
Check Progress for Multiple Supply Shed Tracking IDs¶
JavaScript¶
cURL¶
Monitoring Best Practices¶
Polling Frequency¶
When monitoring batch operations, consider the following polling strategies:
- Initial Phase: Poll every 30-60 seconds for the first few minutes
- Active Processing: Poll every 2-5 minutes during active processing
- Near Completion: Poll every 1-2 minutes as progress approaches 100%
Error Handling¶
Always check the failed field (for batch process) or total_number_of_facilities_failed (for batch supply shed) to detect failures:
progress = response.json()
if isinstance(progress, dict):
if 'failed' in progress and progress['failed']:
print("Batch process has failed!")
elif 'total_number_of_facilities_failed' in progress:
if progress['total_number_of_facilities_failed'] > 0:
print(f"{progress['total_number_of_facilities_failed']} facilities failed")
Completion Detection¶
For batch process operations:
if progress['complete']:
print("Batch process completed successfully!")
elif progress['failed']:
print("Batch process failed!")
else:
print(f"Still processing... {progress['overall_progress']}% complete")
For batch supply shed operations:
if progress['complete']:
print("All facilities have completed processing!")
print(f"Successful: {progress['total_number_of_facilities_completed']}")
print(f"Failed: {progress['total_number_of_facilities_failed']}")
else:
remaining = (
progress['total_number_of_facilities'] -
progress['total_number_of_facilities_completed'] -
progress['total_number_of_facilities_failed']
)
print(f"Still processing {remaining} facilities...")
Response Examples¶
Batch Process Progress (In Progress)¶
{
"n_stages": 4,
"stage": 2,
"progress": 45,
"failed": false,
"complete": false,
"overall_progress": 36
}
Batch Process Progress (Complete)¶
{
"n_stages": 4,
"stage": 4,
"progress": 100,
"failed": false,
"complete": true,
"overall_progress": 100,
"skip_reason": null
}
Batch Process Progress (Skipped)¶
{
"n_stages": 4,
"stage": 4,
"progress": 100,
"failed": false,
"complete": true,
"overall_progress": 100,
"skip_reason": "low - not processed"
}
Batch Process Progress (Failed)¶
{
"n_stages": 4,
"stage": 3,
"progress": 0,
"failed": true,
"complete": false,
"overall_progress": 50
}
Batch Supply Shed Progress (In Progress)¶
{
"complete": false,
"total_number_of_facilities": 100,
"total_number_of_ungeocoded_facilities": 5,
"total_number_of_facilities_failed": 2,
"total_number_of_facilities_completed": 60,
"total_number_of_facilities_queued": 5,
"total_number_of_facilities_preprocessing": 8,
"total_number_of_facilities_processing": 20
}
Batch Supply Shed Progress (Complete)¶
{
"complete": true,
"total_number_of_facilities": 100,
"total_number_of_ungeocoded_facilities": 5,
"total_number_of_facilities_failed": 3,
"total_number_of_facilities_completed": 92,
"total_number_of_facilities_queued": 0,
"total_number_of_facilities_preprocessing": 0,
"total_number_of_facilities_processing": 0,
"skip_reason": null
}
Batch Supply Shed Progress (Skipped)¶
{
"complete": true,
"total_number_of_facilities": 100,
"total_number_of_ungeocoded_facilities": 5,
"total_number_of_facilities_failed": 0,
"total_number_of_facilities_completed": 0,
"total_number_of_facilities_queued": 0,
"total_number_of_facilities_preprocessing": 0,
"total_number_of_facilities_processing": 0,
"skip_reason": "low - not processed"
}
Error Responses¶
400 Bad Request¶
Returned when:
- No tracking ID, tracking IDs, or filename is provided
- Multiple parameters are provided (only one is allowed)
- All tracking IDs in tracking_ids are not for batch supply shed runs
- No tracking IDs are provided when using tracking_ids parameter
- The filename is not a valid hash
Example error messages:
400 Bad Request (Not Found)¶
Returned when the tracking ID does not exist or cannot be found.
This can also occur when: - The tracking ID is invalid - The batch run hasn't been created yet - The user doesn't have access to the batch run
403 Forbidden¶
Returned when the user doesn't have permission to access the batch operation.
Related Endpoints¶
/batch_process: Submit a batch processing operation/batch_supply_shed: Submit a batch supply shed operation/get_task_status: Get detailed task status information/get_collections: List all collections and their status
Notes¶
- The
filenameparameter is deprecated. Usetracking_idinstead for better reliability. - The
tracking_idsparameter only works for batch supply shed operations and will return a combined progress object. - Progress updates are not real-time; there may be a delay of a few seconds to minutes depending on the processing stage.
- For batch supply shed operations, facilities are processed asynchronously, so progress may vary significantly between facilities.