Setup
1. Create requirements file
Createrequirements.txt and upload to S3:
2. Configure Glue job parameters
| Parameter | Value |
|---|---|
--additional-python-modules | zen-engine |
| Parameter | Value |
|---|---|
--python-modules-installer-option | -r |
--additional-python-modules | s3://your-bucket/requirements.txt |
3. IAM permissions
Ensure your Glue job role has access to:- S3 buckets containing rules and data
- Any other AWS services your rules might reference
Singleton evaluator
Use a singleton pattern with precompiledZenDecisionContent for optimal performance:
Basic job
Processing structured columns
Process data from separate columns rather than JSON:Error handling
Return structured results with success/error information:Reading from Glue Data Catalog
Job bookmarks
Enable job bookmarks to process only new data incrementally:Multiple rule files
Process with multiple decision files using a single loaders dict. All decisions are extracted fromdecisions.zip:
Parameterized jobs
Pass rule location as job parameter:Performance tuning
Worker configuration
| Worker Type | vCPU | Memory | Recommended Partitions |
|---|---|---|---|
| G.1X | 4 | 16 GB | 2-4 per worker |
| G.2X | 8 | 32 GB | 4-8 per worker |
| G.4X | 16 | 64 GB | 8-16 per worker |
| G.8X | 32 | 128 GB | 16-32 per worker |
Repartitioning
Coalesce for output
Best practices
Precompile on initialize. TheZenEvaluator converts dict[str, str] to dict[str, ZenDecisionContent] once, then the loader returns precompiled content for maximum performance.
Broadcast loaders dict. Broadcast dict[str, str] (picklable) to all workers. Each worker precompiles once on first use.
Use engine.evaluate directly. No need to call create_decision - the engine’s loader handles everything.
Repartition appropriately. Match partition count to worker count (typically 2-4x the number of DPUs).
Enable job bookmarks. For incremental processing, use transformation_ctx on both reads and writes.
Store rules in S3. Keep decision files in S3 for easy updates without redeploying the job.
The
ZenEvaluator precompiles JSON strings to ZenDecisionContent on first initialization per worker. The engine’s loader then returns precompiled content, avoiding repeated JSON parsing. This provides optimal performance for high-throughput processing.