payu-org / payu

A workflow management tool for numerical models on the NCI computing systems
Apache License 2.0
18 stars 25 forks source link

Updated required libs functionality breaks with solo models #354

Closed aidanheerdegen closed 10 months ago

aidanheerdegen commented 11 months ago

Solo models break with functionality introduced in #351 because their config is never populated with required_libs.

The error looks like this

Traceback (most recent call last):
  File "/g/data3/hh5/public/apps/miniconda3/envs/analysis3-23.04/bin/payu-run", line 10, in <module>
    sys.exit(runscript())
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-23.04/lib/python3.9/site-packages/payu/subcommands/run_cmd.py", line 132, in runscript
    expt.run()
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-23.04/lib/python3.9/site-packages/payu/experiment.py", line 525, in run
    envmod.lib_update(
  File "/g/data/hh5/public/apps/miniconda3/envs/analysis3-23.04/lib/python3.9/site-packages/payu/envmod.py", line 101, in lib_update
    for lib_filename, lib_path in required_libs.items():
AttributeError: 'NoneType' object has no attribute 'items'

and occurs for configs with a single solo model, like MOM6-CICE6.

Each of the sub-models config has the correct information injected here:

https://github.com/payu-org/payu/blob/master/payu/experiment.py#L143

but this not done if there is a solo model.

aidanheerdegen commented 11 months ago

First step is to create a test that reproduces this error. That isn't super straightforward, as there are no existing tests of payu.experiment.run, but it should be possible to instantiate a solo Model and assert that model.required_libs exists and is a dict.

Populating the required_libs should probably be moved to payu.models.model.setup, and payu.models.model.required_libs should be initialised to an empty dict in payu.models.model.init, somewhere here:

https://github.com/payu-org/payu/blob/master/payu/models/model.py#L54