esm-tools / esm_tools

Simple Infrastructure for Earth System Simulations
https://esm-tools.github.io/
GNU General Public License v2.0
25 stars 12 forks source link

ruamel yaml representer error since geomar_dev - release sync #1215

Closed joakimkjellsson closed 2 months ago

joakimkjellsson commented 2 months ago

Good morning

I tried to launch a run today on glogin from the geomar_dev branch but was met with a long error (at the end of this message).

I have been mostly using the feature/blogin-rockylinux9 branch for the past month or so, trying to get some runs done on the new blogin and glogin nodes. When that was working, I merged with geomar_dev which has also been synced a bit with release. The same runscripts which worked fine on feature/blogin-rockylinux9 do no longer work on geomar_dev. I tested a few different runscripts for different versions of FOCI-OpenIFS and same result: works on feature/blogin-rockylinux9 but not geomar_dev.

The error message, ruamel.yaml.representer.RepresenterError: cannot represent an object: (1+0j), does not make much sense to me, but it seems that the yaml parser encounters a complex number (1+0j) and can't represent it. This sounds like there is a 1 somewhere which is accidentally set to 1+0j, but I have no idea where...

Does anyone have any ideas?

Cheers Joakim

(base) [shkjocke@glogin7 orca12_spinup]$ esm_runscripts focioifs-piCtl-orca12-HRA-phase3-restart-glogin.yaml -e orca12-slask-01 -c 
First year, checking if we need to compile...

================================================================================
STARTING SIMULATION JOB!
Experiment ID = orca12-slask-01
Setup = focioifs
This setup consists of:
- oifs
- nemo
- xios
- oasis3mct
- rnfmap
Experiment is installed in:
       /home/shkjocke/esm/esm-experiments//orca12-slask-01
================================================================================
Traceback (most recent call last):
  File "/home/shkjocke/miniforge3/bin/esm_runscripts", line 33, in <module>
    sys.exit(load_entry_point('esm-tools', 'console_scripts', 'esm_runscripts')())
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/cli.py", line 289, in main
    setup()
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/sim_objects.py", line 133, in __call__
    self.prepcompute()
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/sim_objects.py", line 224, in prepcompute
    self.config = prepcompute.run_job(self.config)
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/prepcompute.py", line 26, in run_job
    config = evaluate(config, "prepcompute", "prepcompute_recipe")
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/helpers.py", line 71, in evaluate
    config = esm_plugin_manager.work_through_recipe(
  File "/home/shkjocke/esm/esm_tools/src/esm_plugin_manager/esm_plugin_manager.py", line 159, in work_through_recipe
    config = getattr(submodule, workitem)(config)
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/prepcompute.py", line 271, in _write_finalized_config
    config.yaml_dump(config_file_path)
  File "/home/shkjocke/esm/esm_tools/src/esm_parser/dict_to_yaml.py", line 117, in yaml_dump
    my_yaml.dump(config_final, stream)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/main.py", line 567, in dump
    return self.dump_all([data], stream, transform=transform)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/main.py", line 577, in dump_all
    self._context_manager.dump(data)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/main.py", line 913, in dump
    self._yaml.representer.represent(data)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/representer.py", line 81, in represent
    node = self.represent_data(data)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/representer.py", line 103, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/representer.py", line 316, in represent_dict
    return self.represent_mapping('tag:yaml.org,2002:map', data)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/representer.py", line 842, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/representer.py", line 103, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/representer.py", line 316, in represent_dict
    return self.represent_mapping('tag:yaml.org,2002:map', data)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/representer.py", line 842, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/representer.py", line 113, in represent_data
    node = self.yaml_representers[None](self, data)
  File "/home/shkjocke/miniforge3/lib/python3.10/site-packages/ruamel/yaml/representer.py", line 345, in represent_undefined
    raise RepresenterError(f'cannot represent an object: {data!s}')
ruamel.yaml.representer.RepresenterError: cannot represent an object: (1+0j)
Traceback (most recent call last):
  File "/home/shkjocke/miniforge3/bin/esm_runscripts", line 33, in <module>
    sys.exit(load_entry_point('esm-tools', 'console_scripts', 'esm_runscripts')())
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/cli.py", line 289, in main
    setup()
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/sim_objects.py", line 119, in __call__
    self.config = prepexp.run_job(self.config)
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/prepexp.py", line 27, in run_job
    evaluate(config, "prepexp", "prepexp_recipe")
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/helpers.py", line 71, in evaluate
    config = esm_plugin_manager.work_through_recipe(
  File "/home/shkjocke/esm/esm_tools/src/esm_plugin_manager/esm_plugin_manager.py", line 159, in work_through_recipe
    config = getattr(submodule, workitem)(config)
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/prepexp.py", line 260, in call_esm_runscripts_from_prepexp
    _call_esm_runscripts_internally(config, new_command, scriptsdir)
  File "/home/shkjocke/esm/esm_tools/src/esm_runscripts/prepexp.py", line 193, in _call_esm_runscripts_internally
    subprocess.check_call(command.split(), cwd=exedir)
  File "/home/shkjocke/miniforge3/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['esm_runscripts', 'focioifs-piCtl-orca12-HRA-phase3-restart-glogin.yaml', '-e', 'orca12-slask-01', '-c', '--open-run', '--no-motd', '--last-jobtype', 'prepcompute', '-t', 'prepcompute']' returned non-zero exit status 1.
mandresm commented 2 months ago

Hi @joakimkjellsson,

I think this error was also noticed in the issue #1204 and solved by the PR #1206. If you merge release into your branch or cherry-pick the changes in from that PR.

Please, let me know if that solves the problem :)

joakimkjellsson commented 2 months ago

Thanks for the quick reply @mandresm! I cherry picked this and now it seems to work. Not too "complex" of a solution ;-) /J

mandresm commented 2 months ago

I'm closing this one now then :)