This chapter covers the core features and capabilities of Batch Processor.
max_workers limitFollow this guide to get Batch Processor up and running in your environment.
# Show all available options
python src/batch_processor.py --help
# Run the example job (processes 8 inline orders, 2 will fail validation)
python src/batch_processor.py --config examples/batch_processor_config.json
# Override workers and batch size from the CLI
python src/batch_processor.py --config examples/batch_processor_config.json --workers 4 --batch-size 5
# Save stats to a file
python src/batch_processor.py --config examples/batch_processor_config.json --stats-file run_stats.json
# Verbose debug logging (shows every retry attempt)
python src/batch_processor.py --config examples/batch_processor_config.json --log-level DEBUGDefine complete batch jobs in a JSON config file:
{
"name": "job_name",
"source": {
"type": "inline | json_file | generated",
"id_field": "order_id",
"items": [{"order_id": "ORD-1", "amount": "49.99"}]
},
"transforms": [
{"type": "cast", "field": "amount", "to": "float"},
{"type": "validate", "field": "amount", "op": "gt", "value": 0},
{"type": "map", "field": "name", "operation": "upper"},
{"type": "rename", "field_map": {"old": "new"}},
{"type": "add_field", "field": "source", "value": "batch_v1"},
{"type": "add_timestamp", "field": "processed_at"}
],
"batch_size": 10,
"max_workers": 4,
"retry": {
"max_attempts": 3,
"base_delay": 0.5,
"backoff_factor": 2.0
}
}| Flag | Default | Description |
|---|---|---|
--config, -c | *(required)* | Batch job config file (JSON) |
--workers, -w | 4 | Max concurrent workers (overrides config) |
--batch-size, -b | 10 | Items per batch (overrides config) |
--stats-file | — | Write execution stats JSON to this file |
--log-level | INFO | Logging level (DEBUG, INFO, WARNING, ERROR) |
| Type | Description | Config Fields |
|---|---|---|
cast | Cast a field to int/float/str/bool | field, to |
validate | Fail the item if condition is not met | field, op, value |
map | String operation (upper/lower/strip/title/hash_md5) | field, operation |
rename | Rename fields by mapping | field_map (dict) |
add_field | Add a static key-value pair | field, value |
add_timestamp | Add a UTC ISO-8601 timestamp | field (default: processed_at) |
Get the full Batch Processor and unlock everything.
Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.
Access all interactive tools with complete data, all workload profiles, and the full scenario library.
Downloadable source code, configuration files, and working examples from every chapter.
Free updates for life. Every new chapter, tool, and improvement included.