-
Notifications
You must be signed in to change notification settings - Fork 3
Multiple parameter value parsing breaks some plugins #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
maybe I am wrong but I think that this behaviour makes sense, you will need to run (most likely) freva.databrwoser that in case of multiple values for a key parameter will expect lists as entries |
Yes, the change makes sense. But my point was more that it's a (potentially) breaking change, as many plugins (e.g. leadtimeslect and problems) expect the config to contain a string for the ensemble parameter. I wanted to raise this, as other plugins might also be affected. |
@antarcticrainforest any idea on this? |
|
@bijanf , @felix probably solved locally but in this case problems is failing in at least here: if config_dict["ensemble1"] is not None:
config_dict["ensemble1"] = config_dict["ensemble1"].lower()
if config_dict["ensemble2"] is not None:
config_dict["ensemble2"] = config_dict["ensemble2"].lower() it should be, instead: if config_dict["ensemble1"] is not None:
config_dict["ensemble1"] = [item.lower() for item in config_dict["ensemble1"]]
if config_dict["ensemble2"] is not None:
config_dict["ensemble2"] = [item.lower() for item in config_dict["ensemble2"]] then it fails in leadtimeselector here: if config_dict["ensemble"] != "*":
ensembles = config_dict["ensemble"].split(",")
else:
ensembles = config_dict["ensemble"] it should be always (I think) ensembles = config_dict["ensemble"] and then it trickles down the error somewhere else, but I lost it, here my run 4111 |
@bijanf that wasn't really a minimum example but anyhow. If you look at this changes you can see what is going on: src/evaluation_system/api/parameters.py. The default parameter for Anyway you can get the desired bahaviour by switching back the old code logic, that is setting import freva
freva.list_plugins()
from problems import ProblEMS
plugin = ProblEMS()
for param in plugin.__parameters__.parameters():
if param.name == "ensemble1":
break
param.max_items
# -> 9223372036854775807
plugin.__parameters__.parse_arguments([....,] use_defaults=True)["ensemble1"]
# -> ['s1960-r10i1p1f1',
's1960-r1i1p1f1',
's1960-r3i1p1f1',
's1960-r4i1p1f1',
's1960-r6i1p1f1',
's1960-r7i1p1f1']
param.max_items = 1
plugin.__parameters__.parse_arguments(args, use_defaults=True)["ensemble1"]
's1960-r10i1p1f1,s1960-r1i1p1f1,s1960-r3i1p1f1,s1960-r4i1p1f1,s1960-r6i1p1f1,s1960-r7i1p1f1' So in other words simply put the |
Thanks @antarcticrainforest ! |
I've noticed that since the Coming Decade system version was updated from
2502.1.0
to2504.0.0
, parameters are slightly parsed differently. See for example 4066 and 4084, where the former completed successfully before the update but failed in the latter case (which is a re-run of the former). This is because previously it looks like parameters with multiple values such as forSolrField
, were parsed as comma-delmited strings, and now they are parsed as lists. I'm a bit confused now, because it looks like the baseParameterType
parsed multiple values (as indicated by a comma-delimited string in the default case) as a list for a while now (and not just since the latest release).The issue is that some of our plugins such as
ProblEMS
andleadtimeselect
expect the plugin config to contain strings for certain parameters, which are then parsed by the plugin. For example theensemble1
parameter (aSolrField
) was previously parsed in 4066 ass1960-r10i1p1f1,s1960-r1i1p1f1,s1960-r3i1p1f1,s1960-r4i1p1f1,s1960-r6i1p1f1,s1960-r7i1p1f1,
wheras for 4084 it was parsed as:
['s1960-r10i1p1f1', 's1960-r1i1p1f1', 's1960-r3i1p1f1', 's1960-r4i1p1f1', 's1960-r6i1p1f1', 's1960-r7i1p1f1']
I've created a hotfix for the plugins in the meantime, but I still wanted to raise the issue, in case it appears again for other plugins.
Cheers!
The text was updated successfully, but these errors were encountered: