@@ -191,25 +191,34 @@ def __init__(self, archive_db_config, meta_db_config):
191191 def _normalize_constraints (self , config ):
192192 """Normalize constraint formats in config for breeder workers
193193
194- Converts dict format {"values": [...]} to list format [{"values": [...]}]
195- to ensure workers receive consistent constraint structure.
194+ Recursively converts dict format {"values": [...]} to list format [{"values": [...]}]
195+ to ensure workers receive consistent constraint structure. Handles arbitrary nesting
196+ (e.g., ethtool -> interface -> param -> constraints).
196197
197198 Args:
198199 config: Breeder configuration dict (modified in place)
199200 """
200- settings = config .get ('settings' , {})
201- for category_name , category_settings in settings .items ():
202- if not isinstance (category_settings , dict ):
203- continue
204-
205- for param_name , param_config in category_settings .items ():
206- if not isinstance (param_config , dict ):
207- continue
208-
209- constraints = param_config .get ('constraints' )
210- if constraints and isinstance (constraints , dict ) and 'values' in constraints :
211- # Normalize dict to list format (same logic as ConfigValidator.validate_constraints_v03)
212- param_config ['constraints' ] = [constraints ]
201+ def normalize_dict (obj ):
202+ """Recursively normalize constraint dicts to list format"""
203+ if isinstance (obj , dict ):
204+ # Check if this is a constraints dict that needs normalization
205+ if 'values' in obj and len (obj ) == 1 :
206+ # This is a simple constraints dict: {"values": [...]}
207+ return [obj ] # Wrap in list
208+
209+ # Recursively process all values in the dict
210+ for key , value in obj .items ():
211+ obj [key ] = normalize_dict (value )
212+ return obj
213+ elif isinstance (obj , list ):
214+ # Process lists (though constraints shouldn't be nested in lists)
215+ return [normalize_dict (item ) for item in obj ]
216+ else :
217+ return obj
218+
219+ # Normalize only the settings section
220+ if 'settings' in config :
221+ config ['settings' ] = normalize_dict (config ['settings' ])
213222
214223 def create_breeder (self , breeder_config , name ):
215224 """Create a new breeder instance
0 commit comments