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

Have ErtStorageExceptions not be unexpected in cli #9407

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

jonathan-eq
Copy link
Contributor

@jonathan-eq jonathan-eq commented Dec 2, 2024

This commits makes ErtStorageExceptions not be output as "unexpected error" in cli.

Issue
Resolves #9223

Approach
This PR improves the way ErtStorageExceptions are handled and displayed in the cli. Prior to this PR, ErtStorageExceptions were "unexpected" in the cli.
How it was before this change:

(py312-arm-venv) arm64 ➜  ert git:(fix-storag) ✗ ert ensemble_experiment test-data/ert/snake_oil/snake_oil.ert
Config contains a SUMMARY key but no forward model steps known to generate a summary file
ERT crashed unexpectedly with "Failed to open storage: /Users/JONAK/Documents/FMU/SCOUT/ert/test-data/ert/snake_oil/storage/snake_oil/ensemble with error: Not able to acquire lock for: /Users/JONAK/Documents/FMU/SCOUT/ert/test-data/ert/snake_oil/storage/snake_oil/ensemble. You may already be running ERT, or another user is using the same ENSPATH.".
See logfile(s) for details:
   /Users/JONAK/Documents/FMU/SCOUT/ert/logs/ert-log-snake_oil-ert-2024-12-02T1300.txt

(Screenshot of new behavior in GUI if applicable)

(py312-arm-venv) arm64 ➜  ert git:(fix-storag) ✗ ert ensemble_experiment test-data/ert/snake_oil/snake_oil.ert
Config contains a SUMMARY key but no forward model steps known to generate a summary file
Failed to open storage: /Users/JONAK/Documents/FMU/SCOUT/ert/test-data/ert/snake_oil/storage/snake_oil/ensemble with error: Not able to acquire lock for: /Users/JONAK/Documents/FMU/SCOUT/ert/test-data/ert/snake_oil/storage/snake_oil/ensemble. You may already be running ERT, or another user is using the same ENSPATH.

This is now more similar to how it is output in the gui:
image

  • PR title captures the intent of the changes, and is fitting for release notes.
  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.
  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'pytest tests/ert/unit_tests -n logical -m "not integration_test"')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Create Backport PR to latest release

@jonathan-eq jonathan-eq added the release-notes:bug-fix Automatically categorise as bug fix in release notes label Dec 2, 2024
@xjules
Copy link
Contributor

xjules commented Dec 3, 2024

What about a test?

@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.90%. Comparing base (90c14a9) to head (1b75f60).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9407      +/-   ##
==========================================
+ Coverage   91.83%   91.90%   +0.07%     
==========================================
  Files         434      434              
  Lines       26735    26736       +1     
==========================================
+ Hits        24551    24571      +20     
+ Misses       2184     2165      -19     
Flag Coverage Δ
cli-tests 39.32% <50.00%> (+<0.01%) ⬆️
everest-models-test 34.73% <0.00%> (-0.01%) ⬇️
gui-tests 72.15% <50.00%> (+0.02%) ⬆️
integration-test 37.01% <0.00%> (+0.02%) ⬆️
performance-tests 51.91% <50.00%> (+<0.01%) ⬆️
test 40.68% <0.00%> (+<0.01%) ⬆️
unit-tests 74.10% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


except PermissionError as error:
logger.exception((f"Unexpected exception in ensemble: \n {error!s}"))
await event_unary_send(event_creator(Id.ENSEMBLE_FAILED))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now when this gets propagated I'd expect that you will check such status in the test.(?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was leftovers from 90c14a9 that was included due to some git wizardry 🧙‍♂️.
I will add some tests for it in a different PR 🌴 🌞

This commit:
* Improves the error message displayed when the dark storage server does not have access to the storage path.
* Makes the dark storage server return a response with status code 401 - unauthorized when the `get_ensemble_record` endpoint fails due to `PermissionError`.
* Makes the failed message in `LegacyEnsemble._evaluate_inner` omit stacktrace when it failed due to PermissionError, making it shorter and more consise.
Copy link
Contributor

@xjules xjules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go! 🚀

@jonathan-eq jonathan-eq merged commit e480001 into equinor:main Dec 10, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:bug-fix Automatically categorise as bug fix in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

timeout from LocalStorage.acquire_lock can result in an unhandled exception
3 participants