Fix GFDL site-specific implementation
Closed this issue · 0 comments
The site-specific implementation of the framework is broken in the current code state. running ./mdtf -f <runtime_config file> --site=NOAA_GFDL --data_manager=GFDL_pp
launches the GFDL configuration in the sites/NOAA_GFDL directory, and yields the following error during the attributes definition in src/data_manager/dataSourceBase.init:
CRITICAL: **********************************************************************
CRITICAL: **********************************************************************
Uncaught exception:
Traceback (most recent call last):
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/mdtf_framework.py", line 66, in <module>
exit_code = main()
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/mdtf_framework.py", line 62, in main
exit_code = framework.main()
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/src/core.py", line 1071, in main
case = self.DataSource(case_d, parent=self)
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/src/util/basic.py", line 42, in __call__
instance = abc.ABCMeta.__call__(cls, *args, **kwargs)
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/sites/NOAA_GFDL/gfdl.py", line 449, in __init__
super(GfdlppDataManager, self).__init__(case_dict, parent)
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/sites/NOAA_GFDL/gfdl.py", line 223, in __init__
super(GFDL_GCP_FileDataSourceBase, self).__init__(case_dict, parent)
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/src/data_manager.py", line 808, in __init__
super(DataframeQueryDataSourceBase, self).__init__(case_dict, parent)
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/src/data_manager.py", line 238, in __init__
case_dict, self._AttributesClass, log=self.log, init=True
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/src/util/dataclass.py", line 824, in coerce_to_dataclass
return dc(**new_kwargs)
File "<string>", line 10, in __init__
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/src/util/dataclass.py", line 583, in _new_post_init
_old_post_init(self, *args, **kwargs)
TypeError: __post_init__() takes 1 positional argument but 2 were given
The source of the error is missing arguments in the class gfdl.py:PPDataSourceAttributes __post_init() method:
def __post_init__(self):
"""Validate user input.
"""
super(PPDataSourceAttributes, self).__post_init__()
config = core.ConfigManager()
that overrides the src/util/dataclass.py:mdtf_dataclass __new_post_init method:
def _new_post_init(self, *args, **kwargs):
_new_post_init specifies *args
and **kwargs
parameters that are missing from the super(PPDataSourceAttributes, self).__post_init__()
call, leading to the positional argument error.
Adding the *args and **kwargs parameters to the PPDataSourceAttributes __post_init declaration and super().__post_init() call therein (self is implicitly passed as an argument) appears to solve the issue.
Similarly, adding a parent
parameter to the obj_init call in gfdl.py:GFDLAutoDataManager: new() fixes the error:
CRITICAL: **********************************************************************
Uncaught exception:
Traceback (most recent call last):
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/mdtf_framework.py", line 66, in <module>
exit_code = main()
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/mdtf_framework.py", line 62, in main
exit_code = framework.main()
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/src/core.py", line 1071, in main
case = self.DataSource(case_d, parent=self)
File "/net/Jessica.Liptak/mdtf/MDTF-diagnostics/sites/NOAA_GFDL/gfdl.py", line 600, in __new__
obj.__init__(case_dict)
TypeError: __init__() missing 1 required positional argument: 'parent'