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

Remove the state map for ensembles #6797

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

frode-aarstad
Copy link
Contributor

@frode-aarstad frode-aarstad commented Dec 13, 2023

Issue
Resolves #6736

Approach
Remove the state map from local_ensemble.py. This is replaced by checking the state based on the actual files present in the ensemble directory on disk. We also store any errors with a possible error message on disk in the ensemble.

Pre review checklist

  • Read through the code changes carefully after finishing work
  • Make sure tests pass locally (after every commit!)
  • Prepare changes in small commits for more convenient review (optional)
  • PR title captures the intent of the changes, and is fitting for release notes.
  • Updated documentation
  • Ensured that unit tests are added for all new behavior (See
    Ground Rules),
    and changes to existing code have good test coverage.

Pre merge checklist

  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.

@frode-aarstad frode-aarstad self-assigned this Dec 13, 2023
@frode-aarstad frode-aarstad marked this pull request as draft December 13, 2023 13:25
@frode-aarstad frode-aarstad changed the title Replace has_data and is_initialized Remove the state map for ensemble Dec 18, 2023
@frode-aarstad frode-aarstad changed the title Remove the state map for ensemble Remove the state map for ensembles Dec 18, 2023
@frode-aarstad frode-aarstad force-pushed the fix-state-map branch 3 times, most recently from cd1d739 to 2efa80c Compare December 19, 2023 13:35
@frode-aarstad frode-aarstad marked this pull request as ready for review December 20, 2023 12:52
@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (9123159) 83.79% compared to head (a2ad95d) 83.79%.

Files Patch % Lines
.../gui/tools/manage_cases/case_init_configuration.py 50.00% 1 Missing ⚠️
src/ert/storage/local_ensemble.py 98.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6797      +/-   ##
==========================================
- Coverage   83.79%   83.79%   -0.01%     
==========================================
  Files         368      368              
  Lines       21684    21660      -24     
  Branches      948      948              
==========================================
- Hits        18171    18149      -22     
+ Misses       3219     3217       -2     
  Partials      294      294              

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

@frode-aarstad frode-aarstad force-pushed the fix-state-map branch 2 times, most recently from 7a1676e to 390defc Compare January 2, 2024 12:28
prior_ensemble=ensemble_1,
)
assert _cases(storage) == ["foo1", "foo2"]
assert (
Copy link
Contributor

Choose a reason for hiding this comment

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

Both this test and test_create_ensemble_from_prior end with the same assert. Is it enough to have one of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Not really needed with two tests here

@@ -62,11 +61,7 @@ def test_simulation_context(setup_case, storage, monkeypatch, try_queue_and_sche
assert even_ctx.didRealizationSucceed(iens)
assert not even_ctx.didRealizationFail(iens)
assert even_ctx.isRealizationFinished(iens)

assert even_half.state_map[iens] == RealizationStorageState.HAS_DATA
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a different assert here or OK to remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be safe to remove as this test only simulates and not run any analysis thus has no data

else:
assert odd_ctx.didRealizationSucceed(iens)
assert not odd_ctx.didRealizationFail(iens)
assert odd_ctx.isRealizationFinished(iens)

assert odd_half.state_map[iens] == RealizationStorageState.HAS_DATA
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a different assert here or OK to remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As above

active_realizations: List[bool],
) -> int:
"""Returns the number of loaded realizations"""
pool = ThreadPool(processes=8)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, why 8 threads?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just moved this code so I dont know

Copy link
Contributor

@dafeda dafeda left a comment

Choose a reason for hiding this comment

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

Just a few minor comments.
Great work 👍

@frode-aarstad frode-aarstad force-pushed the fix-state-map branch 3 times, most recently from deb173d to 4cdfe3e Compare January 4, 2024 11:50
@frode-aarstad frode-aarstad merged commit a762b9b into equinor:main Jan 4, 2024
44 checks passed
@frode-aarstad frode-aarstad deleted the fix-state-map branch January 4, 2024 12:25
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

Successfully merging this pull request may close these issues.

Remove HAS_DATA and INITIALIZED from state_map
3 participants