Skip to content
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

clef exception showing all the error stack #91

Open
paolap opened this issue Aug 19, 2019 · 0 comments
Open

clef exception showing all the error stack #91

paolap opened this issue Aug 19, 2019 · 0 comments

Comments

@paolap
Copy link
Member

paolap commented Aug 19, 2019

here's a current example of ClefException:


ClefException Traceback (most recent call last)
in
1 constraints = {'v': 'tas', 'm': 'MIROC5', 'table': 'day', 'experiment': 'rcp85', 'activity': 'CMIP'}
----> 2 results = search(s, project='cmip5', **constraints)

~/.local/lib/python3.6/site-packages/clef/code.py in search(session, project, **kwargs)
40 project=project.upper()
41 valid_keys = get_keys(project)
---> 42 args = check_keys(valid_keys, kwargs)
43 vocabularies = load_vocabularies(project)
44 check_values(vocabularies, project, args)

~/.local/lib/python3.6/site-packages/clef/code.py in check_keys(valid_keys, kwargs)
208 if facet==[]:
209 raise ClefException(
--> 210 f"Warning {key} is not a valid constraint name"
211 f"Valid constraints are:\n{valid_keys.values()}")
212 else:

ClefException: Warning activity is not a valid constraint nameValid constraints are:
dict_values([['source_id', 'model', 'm'], ['realm'], ['time_frequency', 'frequency', 'f'], ['variable_id', 'variable', 'v'], ['experiment_id', 'experiment', 'e'], ['table_id', 'table', 'cmor_table', 't'], ['member_id', 'member', 'ensemble', 'en', 'mi'], ['institution_id', 'institution', 'institute'], ['experiment_family']])

The message at the bottom is quite neat but still all the error stack is shown. This might be confusing for the user who might think that's something that needs to be solved at code level, while we want this to be an exception we can handle.

It is also inconsistent we what we're still doing for the ESGF search.

For example just running clef cmip5 will show only:
Too many results 2292512, try limiting your search:
https://esgf.nci.org.au/search/esgf-nci?query=&type=File&distrib=True&replica=False&latest=True&project=CMIP5

We discussed a solution to this already, I'm not sure if it got lost in all the latest merges or if it wasn't implemented yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant