Skip to content

Commit 64538c4

Browse files
tvalenciazTomas
andauthored
Fixes two minor issues in cfg_vanilla (fixes issue #580) (#581)
* fixes two issues with cfg_vanilla: * making iterk and iter0 solver options not point to the same dict. * making the _hasit() function return false if an option is present in the config dict but set to 'False' * fixing ruff linting issue --------- Co-authored-by: Tomas <valenciazulu1@llnl.gov>
1 parent f2cd00d commit 64538c4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mpisppy/utils/cfg_vanilla.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
def _hasit(cfg, argname):
2121
# aside: Config objects act like a dict or an object TBD: so why the and?
22-
return cfg.get(argname) is not None and cfg[argname] is not None
22+
return cfg.get(argname) is not None and cfg[argname] is not None and \
23+
cfg[argname]
2324

2425
def shared_options(cfg):
2526
shoptions = {
@@ -43,7 +44,7 @@ def shared_options(cfg):
4344
if _hasit(cfg, "solver_options"):
4445
odict = sputils.option_string_to_dict(cfg.solver_options)
4546
shoptions["iter0_solver_options"] = odict
46-
shoptions["iterk_solver_options"] = odict
47+
shoptions["iterk_solver_options"] = copy.deepcopy(odict)
4748
# note that specific options usch as mipgap will override
4849
if _hasit(cfg, "max_solver_threads"):
4950
shoptions["iter0_solver_options"]["threads"] = cfg.max_solver_threads

0 commit comments

Comments
 (0)