Configuration Reference
EngineConfig fields, build-time CMake flags, environment variables, and SIMD diagnostics used by BlazeRules.
BlazeRules configuration has three layers: runtime settings in EngineConfig, build-time CMake options that select features and SIMD kernels, and environment variables used for AWS and s3:// resources.
Defaults prioritize correctness
EngineConfig()requires no overrides. Runtime settings should be changed only after measuring the target workload.
EngineConfig options
EngineConfig is configured by attribute and passed to RuleEngine. The Python binding exposes the fields below.
Batch execution and models
| Option | Type / values | Default | Purpose |
|---|---|---|---|
batch_size | Positive int | 10000 | Preferred row count for batch-oriented entry points and adapters. |
parallel_threshold | Positive int | 1000 | Minimum row count before parallel evaluation is considered. |
eval_thread_count | Non-negative int | 0 | Evaluation worker count. 0 uses the runtime default. |
model_intra_op_threads | Positive int | 1 | ONNX Runtime intra-op threads per model session. 1 avoids oversubscription when several engine shards run inference concurrently. |
enable_thread_affinity | bool | False | Enables best-effort worker affinity on supported platforms. |
enable_prefetch | bool | False | Enables kernel prefetch hints where implemented. |
Result materialization and tracing
| Option | Type / values | Default | Purpose |
|---|---|---|---|
output_detail | COUNTS, CODES, DECISIONS, BITMASKS | BITMASKS | Selects aggregate counts, compact row codes, routing results, or routing results plus per-rule masks. |
result_buffer_reuse | bool | True | Reuses eligible result buffers between batches. Retained arrays must be copied before the next evaluation when this option is enabled. |
trace_mode | TRACE_NONE, TRACE_SAMPLED, TRACE_ALL | TRACE_NONE | Controls explanation/trace generation. |
trace_sample_rate | float from 0 to 1 | 0.05 | Sampling fraction used by TRACE_SAMPLED. |
decision_log_path | Path string | Empty | Enables compact NDJSON decision logging when set. |
dead_letter_path | Path string | Empty | Destination for malformed records when dead-letter routing is enabled. |
max_error_samples | Non-negative int | 16 | Maximum ingest error samples retained in each BatchResult. |
Ingest and schema policy
| Option | Type / values | Default | Purpose |
|---|---|---|---|
ingest_error_mode | SKIP_AND_COUNT, SKIP_TO_DEAD_LETTER, HARD_FAIL | SKIP_AND_COUNT | Skips malformed records, writes them to the dead-letter sink, or aborts the batch. |
type_mismatch_mode | NULL_ON_TYPE_ERROR, COERCE, HARD_FAIL_TYPE | NULL_ON_TYPE_ERROR | Converts mismatched values to null, attempts safe coercion, or aborts evaluation. |
max_dict_size_per_column | Positive int | 100000 | Maximum dictionary cardinality for a dictionary-encoded column. Entity keys are not collapsed into an overflow ID. |
arena_size_bytes | Positive int | 8388608 | Initial per-engine arena capacity in bytes. |
Windows and state
| Option | Type / values | Default | Purpose |
|---|---|---|---|
max_window_entities | Positive int | 10000000 | Maximum tracked entities across window state. |
eviction_sweep_interval_minutes | Positive int | 5 | Interval between expired-state eviction sweeps. |
Predicate execution
| Option | Type / values | Default | Purpose |
|---|---|---|---|
enable_selection_vectors | bool | True | Enables sparse selection-vector execution. |
selection_vector_threshold | float from 0 to 1 | 0.20 | Selectivity threshold below which selection vectors may be used. |
enable_adaptive_predicate_ordering | bool | True | Allows predicate ordering to adapt from observed selectivity. |
enable_no_validity_fast_path | bool | True | Uses specialized kernels when projected columns contain no nulls. |
simd_backend_override | "auto", "scalar", "neon", "sse2", "avx2", "avx512" | "auto" | Selects runtime dispatch or forces a supported SIMD backend. Unsupported overrides fail with a structured error rather than executing an illegal instruction. |
enable_avx512 | bool | False | Allows AVX-512 selection in automatic mode when the compiled binary, CPU, and operating system support it. |
Hot reload
| Option | Type / values | Default | Purpose |
|---|---|---|---|
hot_reload_poll_seconds | Positive int | 5 | File polling interval for background rule reload. |
hot_reload_validate_conflicts | bool | True | Runs conflict analysis before activating a candidate ruleset. |
hot_reload_keep_previous_on_failure | bool | True | Keeps the active ruleset when candidate loading or validation fails. |
output_detailinteger values shifted — reference it by name
OutputDetail.COUNTSandOutputDetail.CODESwere added beforeDECISIONSandBITMASKSin the underlying enum, so the raw integer values shifted:DECISIONSandBITMASKSused to be0and1and are now2and3. Any config that serializedoutput_detailas a raw integer instead of the named constant —EngineConfig::OUTPUT_DECISIONSin C++,blazerules.OutputDetail.DECISIONSin Python, or a bare number in a hand-rolled config file — will silently resolve to a different, cheaper output tier after upgrading. Always setoutput_detailby name, never by number. See Decisions & Scoring for what each tier materializes.
Constructing an engine with a config
import blazerules
config = blazerules.EngineConfig()
config.output_detail = blazerules.OutputDetail.DECISIONS
config.ingest_error_mode = blazerules.IngestErrorMode.SKIP_AND_COUNT
config.type_mismatch_mode = blazerules.TypeMismatchMode.NULL_ON_TYPE_ERROR
config.simd_backend_override = "auto"
config.enable_avx512 = False
engine = blazerules.RuleEngine(config)
engine.load_rules("rules.yaml")import blazerules
config = blazerules.EngineConfig()
schema = [
blazerules.Field("card_token", "entity_key"),
blazerules.Field("amount", "float32"),
blazerules.Field("account_age_days", "int32"),
]
# Pass an explicit schema instead of inferring it from the first batch.
engine = blazerules.RuleEngine(schema, config)
engine.load_rules("rules.yaml")
Constructor forms
RuleEngine()uses defaults and infers schema from the first batch.RuleEngine(config)applies runtime settings and still infers schema.RuleEngine(schema, config)binds explicit field types before evaluation. See Data Model & Schema for inference and drift semantics.
Setting these from the CLI
The commonly used runtime options map to blazerules eval flags:
EngineConfig attribute | blazerules eval flag |
|---|---|
output_detail | --output-detail |
ingest_error_mode | --ingest-error-mode |
type_mismatch_mode | --type-mismatch-mode |
simd_backend_override | --simd-backend |
batch_size | --batch-size |
eval_thread_count | --threads |
decision_log_path | --decision-log |
dead_letter_path | --dead-letter-log |
blazerules ... --config config.yaml accepts the supported CLI configuration keys under an engine: block. Explicit flags take precedence. The complete command and value tables are in API & CLI Values.
Build-time CMake options
These options select compiled features and SIMD kernels during CMake configuration. The project defaults enable the complete feature set.
| Option | Default | Purpose |
|---|---|---|
BLAZERULES_ENABLE_ONNX | ON | Enables model_score rules and register_model() |
BLAZERULES_IO | ON | Builds blazerules_io connectors/decoders |
BLAZERULES_IO_KAFKA | ON | Kafka source/sink inside blazerules_io |
BLAZERULES_IO_AVRO | ON | Avro binary decoder |
BLAZERULES_IO_PROTOBUF | ON | Protobuf descriptor decoder |
BLAZERULES_IO_S3 | ON | Native Arrow S3 reads with AWS CLI fallback support |
BLAZERULES_DASHBOARD | ON | Local read-only dashboard executable |
BLAZERULES_AGENT | ON | Local multi-input log/HTTP/file agent |
BLAZERULES_NATIVE_TUNE | ON | Local -march=native style tuning |
BLAZERULES_X86_AVX2 | ON | Builds runtime-dispatched AVX2 kernels on x86_64 |
BLAZERULES_X86_AVX512 | ON | Builds optional AVX-512 kernels on x86_64 |
BLAZERULES_IO_KAFKAonly matters whenBLAZERULES_IO=ONThe Kafka, Avro, Protobuf, and S3 sub-options have no effect unless the IO module is built with
-DBLAZERULES_IO=ON. Release wheels and default source builds enable the IO module. Python exposes runtime capability checks ashas_kafka,has_avro, andhas_protobuf. There is nohas_s3attribute; native S3 support is selected at build time and can fall back to the AWS CLI path. See Troubleshooting for connector diagnostics.
Portable Linux, Windows, and cloud builds do not compile generic code with global AVX flags. ISA-specific files are compiled separately and selected at runtime. For ready-made build shapes per platform, use the presets documented in Deployment.
Environment variables
The engine reads exact-object s3://bucket/key URIs for rules, lookup CSVs, and ONNX models. Configure the profile, region, and endpoint with environment variables or the equivalent set_aws_profile(), set_aws_region(), and set_aws_endpoint_url() functions.
export BLAZERULES_AWS_PROFILE=personal
export BLAZERULES_AWS_REGION=us-east-1
export BLAZERULES_AWS_ENDPOINT_URL=http://127.0.0.1:9000BLAZERULES_AWS_ENDPOINT_URL supports S3-compatible endpoints such as MinIO. Credentials belong in the deployment platform's secret mechanism rather than source-controlled files.
SIMD diagnostics
Two read-only helpers report the selected backend and detected CPU features.
import blazerules
print(blazerules.simd_backend()) # e.g. "neon" on an Apple M1
print(blazerules.cpu_features_summary()) # human-readable CPU feature listOn Apple Silicon, simd_backend() normally reports neon. On an x86_64 host with AVX2 support, it normally reports avx2. A supported simd_backend_override changes the selected backend.
AVX-512 auto-selection is still runtime-gatedAVX-512 kernels are compiled in full builds, but runtime selection still checks CPU and OS support. Some server CPUs reduce frequency under wide vectors, which can make AVX-512 slower than AVX2 for mixed rule workloads. Benchmark the production ruleset and target hardware before forcing a backend.
Related documentation
Updated about 2 months ago