Skip to content

Reduce global state and use esmvalcore.config.Session objects instead #2954

@bouweandela

Description

@bouweandela

In various places in the code, things depend on the value of esmvalcore.config.CFG instead of working with a esmvalcore.config.Session object. This may cause problems if users expect that the sessions work independently.

For example, changing the config_developer_file parameter in a session will change the esmvalcore.cmor.table.CMOR_TABLES global variable. It would be better to avoid global state as much as possible to avoid confusion and bugs.

The cleanest implementation seems to be only to use esmvalcore.config.CFG to start new sessions and not for any other purpose. The sessions would then need to be passed around to functions that need access to configuration. Modifying esmvalcore.config.CFG or the sessions should not have any side effects. esmvalcore.cmor.table.CMOR_TABLES will need to be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions