Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default diagnostics attrs not being copied to parent CoreParameter #778

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions e3sm_diags/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,16 @@ def _get_parameters_with_api_and_cfg(
"""
run_params = []

if self.is_cfg_file_arg_set:
cfg_params = self._get_custom_params_from_cfg_file()
else:
run_type = parameters[0].run_type
cfg_params = self._get_default_params_from_cfg_file(run_type)

if len(self.sets_to_run) == 0:
self.sets_to_run = DEFAULT_SETS

for set_name in self.sets_to_run:
if self.is_cfg_file_arg_set:
cfg_params = self._get_custom_params_from_cfg_file()
else:
run_type = parameters[0].run_type
cfg_params = self._get_default_params_from_cfg_file(run_type)

param = self._get_instance_of_param_class(
SET_TO_PARAMETERS[set_name], parameters
)
Expand All @@ -186,14 +186,9 @@ def _get_parameters_with_api_and_cfg(
self._remove_attrs_with_default_values(param)
param.sets = [set_name]

# # FIXME: Make a deep copy of cfg_params because there is some
# buggy code in this method that changes parameter attributes in
# place, which affects downstream operations. The original
# cfg_params needs to be perserved for each iteration of this
# for loop.
params = self.parser.get_parameters(
orig_parameters=param,
other_parameters=copy.deepcopy(cfg_params),
other_parameters=cfg_params,
cmd_default_vars=False,
argparse_vals_only=False,
)
Expand Down
Loading