Understanding Resource Settings
ZenML’sResourceSettings class provides a unified interface for specifying:
- CPU cores: Number of CPU cores allocated to a step
- Memory: Amount of RAM allocated to a step
- GPU: Number of GPU devices allocated to a step
- Replicas: Minimum and maximum instance counts (for deployed pipelines)
- Autoscaling: Metrics and targets for automatic scaling
- Concurrency: Maximum concurrent requests per instance
Basic Resource Configuration
Configuring a Single Step
Specify resources when defining a step:Configuring at Pipeline Level
Apply default resources to all steps:Memory Specification
Memory Units
ZenML supports standard memory units:Converting Memory Units
Programmatically convert between units:GPU Configuration
Requesting GPUs
Multi-GPU Training
Orchestrator Implementation
Reading Resource Settings
Orchestrators access resource settings from step configurations:Platform-Specific Resource Mapping
Different platforms use different resource specifications:Deployed Pipeline Resources
For deployed pipelines (as services), additional resource settings control scaling behavior:Replica Configuration
Autoscaling Configuration
Concurrency Limits
Checking Resource Requirements
Orchestrators can check if a step needs special resources:Best Practices
Start Conservative
Begin with modest resource requests and scale up based on actual usage.
Monitor Usage
Track actual resource consumption to optimize configurations.
GPU Cost Awareness
GPUs are expensive. Only request them for steps that benefit from acceleration.
Memory Buffer
Request slightly more memory than expected to handle variability.
Resource Sizing Guidelines
Data Loading Steps:Validation
ZenML validates resource settings:Next Steps
Custom Orchestrators
Build orchestrators that handle resource configurations
Containerization
Package steps with their dependencies
Dynamic Pipelines
Adapt resource requirements at runtime
Custom Materializers
Handle data efficiently to optimize memory usage
