@@ -108,15 +108,6 @@ def load_config():
108108 with open (args .config_file ) as reader :
109109 config = yaml .safe_load (reader )
110110
111- # Parse overriden params.
112- for param in args .params :
113- fqn_key , value = param .split ("=" )
114- entry_to_change = config
115- keys = fqn_key .split ("." )
116- for k in keys [:- 1 ]:
117- entry_to_change = entry_to_change [k ]
118- entry_to_change [keys [- 1 ]] = yaml .safe_load (value )
119-
120111 available_agents = [item for item in list (config .keys ()) if item != "base" ]
121112
122113 if not args .agent :
@@ -130,14 +121,25 @@ def load_config():
130121 if "base" in config :
131122 # base config is specified (shared across agents)
132123 return_config = config ["base" ]
133- agent_specific_config = config [args .agent ]
134- for key in agent_specific_config :
135- # override base config with agent specific config
136- return_config [key ] = agent_specific_config [key ]
124+ # Override base config with agent specific config
125+ for key , value in config [args .agent ].items ():
126+ return_config [key ] = value
137127 else :
138128 # base config is not specified
139129 return_config = config [args .agent ]
140130
131+ # Parse overriden params.
132+ for param in args .params :
133+ fqn_key , value = param .split ("=" )
134+ entry_to_change = return_config
135+ keys = fqn_key .split ("." )
136+ for k in keys [:- 1 ]:
137+ if k not in entry_to_change :
138+ entry_to_change [k ] = {}
139+
140+ entry_to_change = entry_to_change [k ]
141+ entry_to_change [keys [- 1 ]] = yaml .safe_load (value )
142+
141143 # assume agent type is the key if not specified by the user
142144 if not return_config .get ("agent_type" ):
143145 return_config ["agent_type" ] = args .agent
0 commit comments