Description
when capgen-v1 is run it writes the messages Reading host metadata: and Reading scheme metadata: to the logger, which itself goes to stdout. For most of the routines in capgen-v1 it checks if the caller is providing its own python log, and then uses that to write messages. However, for the _load_metadata_files() routine it only uses the internal _LOGGER variable, which in the case of CAM-SIMA was pointing to the same stream as CIME's logger, resulting in the Reading XYZ metadata messages being written twice each time.
This bug can be fixed by simply updating _load_metadata_files to use a host-provided logger when it exists, which is the same strategy that other capgen-v1 routines use.
A PR is incoming.
Steps to Reproduce
- Use the head of the
feature/capgen-v1 branch (e.g. hash 09ae1d7) in CAM-SIMA.
- Create a case with any physics suite.
- Run
case.setup in the case directory.
- Run
preview_namelists in the case directory, which triggers the code generation step for capgen-v1
- Examine the messages being printed to the screen, and notice the ones that are being repeated twice each time.
Additional Context
I am guessing this issue is only present when using CAM-SIMA as it would only appear when using the python interface. The CLI is likely fine.
Description
when capgen-v1 is run it writes the messages
Reading host metadata:andReading scheme metadata:to the logger, which itself goes to stdout. For most of the routines in capgen-v1 it checks if the caller is providing its own python log, and then uses that to write messages. However, for the_load_metadata_files()routine it only uses the internal_LOGGERvariable, which in the case of CAM-SIMA was pointing to the same stream as CIME's logger, resulting in theReading XYZ metadatamessages being written twice each time.This bug can be fixed by simply updating
_load_metadata_filesto use a host-provided logger when it exists, which is the same strategy that other capgen-v1 routines use.A PR is incoming.
Steps to Reproduce
feature/capgen-v1branch (e.g. hash09ae1d7) in CAM-SIMA.case.setupin the case directory.preview_namelistsin the case directory, which triggers the code generation step forcapgen-v1Additional Context
I am guessing this issue is only present when using CAM-SIMA as it would only appear when using the python interface. The CLI is likely fine.