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

Fix diagnostic filter #713

Merged
merged 6 commits into from
Jul 20, 2020
Merged

Fix diagnostic filter #713

merged 6 commits into from
Jul 20, 2020

Conversation

jvegreg
Copy link
Contributor

@jvegreg jvegreg commented Jul 14, 2020

There is an issue with the diagnostics filter if you try to filter only one diagnostic (see #712 )

This pull request fixes it

Tasks

  • Create an issue to discuss what you are going to do, if you haven't done so already (and add the link at the bottom)
  • This pull request has a descriptive title that can be used in a changelog
  • Add unit tests
  • Public functions should have a numpy-style docstring so they appear properly in the API documentation. For all other functions a one line docstring is sufficient.
  • If writing a new/modified preprocessor function, please update the documentation
  • Circle/CI tests pass. Status can be seen below your pull request. If the tests are failing, click the link to find out why.
  • Codacy code quality checks pass. Status can be seen below your pull request. If there is an error, click the link to find out why. If you suspect Codacy may be wrong, please ask by commenting.
  • Please use yamllint to check that your YAML files do not contain mistakes
  • If you make backward incompatible changes to the recipe format, make a new pull request in the ESMValTool repository and add the link below

If you need help with any of the tasks above, please do not hesitate to ask by commenting in the issue or pull request.


Closes #712

schlunma and others added 3 commits July 9, 2020 12:29
* Fixed calculation of time weights

* Fixed failing FLAKE8 test

* Added more test for time weighting and fixed cube dimensions in test
* Remove utils section (#697)

Moved the last script from esmvalcore/utils to ESMValTool

* Fixed bug in time weights calculation (#695)

* Fixed calculation of time weights

* Fixed failing FLAKE8 test

* Added more test for time weighting and fixed cube dimensions in test

* Avoid pytest version that crashes (#707)

* Suggested Documentation changes (#690)

Update documentation on relative diagnostics paths and preprocessor order.

Co-authored-by: Bouwe Andela <bouweandela@gmail.com>

* Options arg in read_config_user_file now optional

* Fix codacy warning

Co-authored-by: Bouwe Andela <b.andela@esciencecenter.nl>
Co-authored-by: Manuel Schlund <32543114+schlunma@users.noreply.github.com>
Co-authored-by: Steve Smith <ssmith@pnnl.gov>
Co-authored-by: Bouwe Andela <bouweandela@gmail.com>
@jvegreg jvegreg requested a review from schlunma July 14, 2020 10:42
@jvegreg jvegreg changed the base branch from master to v2.0.0 July 14, 2020 10:48
@jvegreg jvegreg added the bug Something isn't working label Jul 14, 2020
@jvegreg jvegreg added this to the v2.0.0 milestone Jul 14, 2020
@schlunma
Copy link
Contributor

Tested successfully, thanks for the quick fix! 🎉 I think you should merge this in master and not v2.0.0, Bouwe will cherry-pick this from master once this is merged.

@jvegreg jvegreg changed the base branch from v2.0.0 to master July 14, 2020 15:07
@bouweandela
Copy link
Member

I tried to test this, but how do I select two tasks?

I ran

$ esmvaltool run examples/recipe_python.yml --diagnostics diagnostic1/pr diagnostic1/script1

and the output was:

ERROR: Config file /home/bandela/src/esmvalgroup/esmvalcore/diagnostic1/script1 does not exist
ERROR:esmvalcore._main:Program terminated abnormally, see stack trace below for more information
Traceback (most recent call last):
  File "/home/bandela/src/esmvalgroup/esmvalcore/esmvalcore/_main.py", line 430, in run
    fire.Fire(ESMValTool())
  File "/home/bandela/conda/envs/esmvaltool/lib/python3.8/site-packages/fire/core.py", line 138, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/home/bandela/conda/envs/esmvaltool/lib/python3.8/site-packages/fire/core.py", line 463, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/home/bandela/conda/envs/esmvaltool/lib/python3.8/site-packages/fire/core.py", line 672, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/home/bandela/src/esmvalgroup/esmvalcore/esmvalcore/_main.py", line 366, in run
    cfg = read_config_user_file(config_file, recipe_name, kwargs)
  File "/home/bandela/src/esmvalgroup/esmvalcore/esmvalcore/_config.py", line 42, in read_config_user_file
    with open(config_file, 'r') as file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/bandela/src/esmvalgroup/esmvalcore/diagnostic1/script1'

It looks like the second task is somehow interpreted as the config-user file?

@jvegreg
Copy link
Contributor Author

jvegreg commented Jul 20, 2020

how do I select two tasks?

Like this,

$ esmvaltool run examples/recipe_python.yml --diagnostics '("diagnostic1/pr", "diagnostic1/script")'

but I am going to modify it a bit so it also accepts

$ esmvaltool run examples/recipe_python.yml --diagnostics 'diagnostic1/pr diagnostic1/script'

@bouweandela
Copy link
Member

Thanks! Could you also document that syntax somewhere?

@jvegreg
Copy link
Contributor Author

jvegreg commented Jul 20, 2020

Thanks! Could you also document that syntax somewhere?

Yes.

Can you please test the branch locally? The tests run fine on my computer but fail in CircleCI, and I do not understand why

@bouweandela
Copy link
Member

I think it's an old Python issue #719

@bouweandela
Copy link
Member

Merging this now, because I want to make the release today. Can you please make a new pull request to document how to use the feature?

@bouweandela bouweandela merged commit 046d34d into master Jul 20, 2020
@bouweandela bouweandela deleted the fix_diagnostic_filter branch July 20, 2020 14:27
bouweandela pushed a commit that referenced this pull request Jul 20, 2020
Make syntax to select some diagnostics more intuitive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--diagnostics option in CLI fails
3 participants