Skip to content

Commit

Permalink
fix(pr-review): call ngen_cal_model_configure after Agent init
Browse files Browse the repository at this point in the history
Agent mutates the model config; If ngen_cal_model_configure is called
before the Agent is initialized, it won't get the final view of the
config before calibration.

Co-authored-by: Nels <[email protected]>
  • Loading branch information
aaraney and hellkite500 committed Aug 15, 2024
1 parent dd18e0e commit 813def9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/ngen_cal/src/ngen/cal/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def main(general: General, model_conf: Mapping[str, Any]):

# setup plugins
plugin_manager.hook.ngen_cal_configure(config=general)
model_inner._plugin_manager.hook.ngen_cal_model_configure(config=model_inner)

print("Starting calib")

Expand All @@ -69,6 +68,10 @@ def main(general: General, model_conf: Mapping[str, Any]):

# Initialize the starting agent
agent = Agent(model, general.workdir, general.log, general.restart, general.strategy.parameters)

# Agent mutates the model config, so `ngen_cal_model_configure` is called afterwards
model_inner._plugin_manager.hook.ngen_cal_model_configure(config=model_inner)

if general.strategy.algorithm == Algorithm.dds:
func = dds_set #FIXME what about explicit/dds
start_iteration = general.start_iteration
Expand Down

0 comments on commit 813def9

Please sign in to comment.