batch command group provides operations for performing actions on multiple workflows simultaneously based on queries.
Command Overview
- Terminate multiple workflows
- Signal multiple workflows
- Cancel multiple workflows
- Monitor batch job progress
Batch operations run as workflows in the special
cadence-batcher domain. This provides fault tolerance and progress tracking.Starting Batch Jobs
batch start
Start a new batch operation job.SQL-like query to select target workflows
Reason for the batch operation (for auditing)
Operation type:
terminate, cancel, or signalRate limit in operations per second
Page size for processing workflows
Number of concurrent operations
Skip confirmation prompt
Retry attempts for retriable errors
Activity heartbeat timeout in seconds
Max activity retries before workflow retry (0 = unlimited)
Batch Types
Terminate Batch
Terminate multiple workflows.Cancel Batch
Gracefully cancel multiple workflows.Signal Batch
Send signals to multiple workflows.Signal name (required for signal batch type)
Signal payload as JSON (optional)
Monitoring Batch Jobs
batch describe
Check batch job status and progress.Batch job ID returned from start command
batch list
List batch jobs for a domain.Number of results to return
Stopping Batch Jobs
batch terminate
Stop a running batch job.Batch job ID to terminate
Reason for termination
Query Examples
By Workflow Type
By Time Range
By Status
By Custom Search Attributes
Complex Queries
Rate Limiting and Performance
Conservative Settings
For production systems under load:Aggressive Settings
For dedicated maintenance windows:Monitoring Progress
Continuously monitor a batch job:Error Handling
Viewing Failed Operations
The batch job tracks failures in its progress:failedCount in the output.
Retry Configuration
retry_attempts: Retries for individual workflow operationsmax_activity_retries: Activity retries before workflow retry
Common Use Cases
Clean Up Old Workflows
Emergency Stop
Feature Flag Update
Graceful Shutdown
Best Practices
- Test Queries: Use
cadence workflow countto verify query before batch operation - Dry Run: Start with small
rpsandconcurrencyvalues - Monitor: Watch progress with
batch describeregularly - Off-Peak: Schedule large batch operations during low-traffic periods
- Documentation: Always provide descriptive
reasonfor auditing - Confirmation: Use
--yesflag only in automated scripts
Verification
Before Starting Batch
Verify the query selects the correct workflows:During Batch Operation
After Batch Operation
Troubleshooting
Batch job stuck
Batch job stuck
Problem: Progress not advancingSolutions:
- Check batch job workflow:
cadence workflow describe -w job-uuid --domain cadence-batcher - Verify workers are running for
cadence-batcherdomain - Check server logs for errors
High failure rate
High failure rate
Problem: Many operations failingCauses:
- Workflows already terminated/completed
- Invalid signal names
- Rate limiting on server
- Review query to ensure correct workflows
- Verify signal handler exists in workflow code
- Reduce
rpsandconcurrency
Batch job not starting
Batch job not starting
Problem: Start command succeeds but no progressSolutions:
- Verify
cadence-batcherdomain exists - Check if workers are polling
cadence-batcher-tasklist - Review server logs for startup errors
Batch Job Lifecycle
- Started: Job workflow created, query validation begins
- Running: Processing workflows page by page
- Completed: All workflows processed successfully
- Failed: Unrecoverable error occurred
- Terminated: Manually stopped via terminate command
Next Steps
Workflow Commands
Individual workflow operations
Workflow Reset
Batch reset operations
Admin Commands
Administrative operations
Operations Guide
Operations best practices