Skip to content

Commit

Permalink
Make jcb rendering method save copies of jcb_config and task_ocnfig
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidNew-NOAA committed Oct 23, 2024
1 parent 1c0fcf1 commit 74e5efa
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ush/python/pygfs/jedi/jedi.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ def __init__(self, config) -> None:
# Save a copy of jedi_config
self._jedi_config = self.jedi_config.deepcopy()

# Create a dictionary of dictionaries for saving copies of the jcb_config
# associated with each algorithm
self._jcb_configs = AttrDict()

# Create a dictionary of dictionaries for saving copies of the task_config
# used to render each JCB template
self._task_configs_for_jcb = AttrDict()

@logit(logger)
def initialize(self, task_config: AttrDict) -> None:
"""Initialize JEDI application
Expand Down Expand Up @@ -156,9 +164,13 @@ def render_jcb(self, task_config: AttrDict, algorithm: Optional[str] = None) ->
elif 'algorithm' in jcb_config:
pass
else:
raise KeyError(f"FATAL ERROR: JCB algorithm must be specified as input to jedi.render_jcb(), " +
raise Exception(f"FATAL ERROR: JCB algorithm must be specified as input to jedi.render_jcb(), " +
"in JEDI configuration dictionary as jcb_algo, or in JCB algorithm YAML")

# Save copies of the task_config and jcb_config used to render this JCB template
self._task_configs_for_jcb[jcb_config['algorithm']] = task_config.deepcopy()
self._jcb_configs[jcb_config['algorithm']] = jcb_config.deepcopy()

# Generate JEDI YAML config by rendering JCB config dictionary
jedi_input_config = render(jcb_config)

Expand Down

0 comments on commit 74e5efa

Please sign in to comment.