Skip to main content
A BatchOperation tracks the outcome of a bulk trigger request against a Job. When you trigger a job with multiple items in a single request (via POST /v1/jobs/{jobID}/trigger-bulk), Strait creates a batch operation to record how many items were submitted and how many Runs were actually created.

BatchOperation Model

The BatchOperation struct (defined in apps/strait/internal/domain/types.go) contains the following fields:

How Batch Operations Work

Batch operations are not created directly through the API. They are created automatically when a bulk trigger request is made:
  1. A client sends a POST /v1/jobs/{jobID}/trigger-bulk request containing multiple items.
  2. Strait creates a BatchOperation record with item_count set to the number of items in the request.
  3. For each item, Strait attempts to create a run. The resulting runs have their batch_id field set to the batch operation’s id.
  4. created_count reflects the number of runs that were actually created. This may be lower than item_count if some items were deduplicated (see dedup_window_secs).
  5. Once all items have been processed, finished_at is set.
The difference between item_count and created_count is a useful signal. A large gap typically indicates deduplication is filtering out duplicate payloads within the configured window.

Querying Batch Status

Two read-only endpoints are available for inspecting batch operations: To find all runs that belong to a specific batch, query runs and filter by batch_id:
A batch operation is considered complete when finished_at is non-null.
  • Jobs: The job definition that was bulk-triggered.
  • Runs: Individual execution instances created by the batch. Each run’s batch_id links back to its originating batch operation.