-
Notifications
You must be signed in to change notification settings - Fork 104
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
Add migration from BlockFs storage #4937
Conversation
69157fd
to
15c6162
Compare
74b699d
to
c0eb4d5
Compare
aa277a5
to
8ac4494
Compare
7095ceb
to
491ec4d
Compare
f0aa918
to
fed5b18
Compare
59c713f
to
716dfcb
Compare
Codecov Report
@@ Coverage Diff @@
## main #4937 +/- ##
==========================================
- Coverage 77.88% 77.09% -0.79%
==========================================
Files 391 393 +2
Lines 25545 25926 +381
Branches 1675 1760 +85
==========================================
+ Hits 19895 19987 +92
- Misses 5064 5353 +289
Partials 586 586
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
9a08e68
to
6a216f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! A minor question and nitpicky comment
size_t len; | ||
size_t count; | ||
|
||
bool is_compressed() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not seem to be used?
self.path = Path(path) | ||
if not ignore_migration_check and local_storage_needs_migration(self.path): | ||
from ert.storage.migration.block_fs import migrate # pylint: disable=C0415 | ||
|
||
migrate(self.path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used at the moment, perhaps turn this migration into an issue instead? I would suggest moving this to the main entry point instead, so we have more control of the migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be used in production (if storage needs migration, migrate)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be optional though? So you get a prompt, saying would you like to delete or migrate?
tests/unit_tests/storage/migration/test_block_fs_simple_case.py
Outdated
Show resolved
Hide resolved
ensemble = experiment.create_ensemble(name="default", ensemble_size=5) | ||
bf._migrate_field(ensemble, parameter, ens_config) | ||
|
||
for key, data in data["/REAL_0/FIELD"].groups.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to parameterize this instead? Cant immediately see how, but think it might be possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can metaprogram myself to a solution, ie:
@pytest.mark.parameterize("type", ["field", "surface"])
def test_stuff(type):
getattr(bf, f"_migrate_{type}")(ensemble, parameter, ens_config)
for key, data in data[f"/REAL_0/{type.upper()}"].groups.items():
...
Do we want to use getattr
in this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, fine to leave it as is
What are the benefits of using C++ for this? |
} | ||
} | ||
|
||
auto parse_name(const std::string &name, Kind kind) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does name
refer to here?
Also, seems like parse_name
is only tested for Kind::SUMMARY
.
Is it worthwhile adding tests for other kinds as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I just forgot to do so.
842c443
to
964018e
Compare
m_stream.read(name.data(), name.size()); | ||
skip<char>(m_stream); // NULL terminator | ||
|
||
auto node_size = read_i32(m_stream, nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
annotate-cpp FTW :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
annotate-cpp
complained that node_size
was not used.
51ae460
to
7a3952b
Compare
std::ifstream m_stream; | ||
/** Stream mutex */ | ||
mutable std::mutex m_mutex; | ||
/** List of SUMMARY blocks */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think comment is outdated as m_blocks
holds other kinds of blocks as well.
return False | ||
|
||
try: | ||
with open("index.json", encoding="utf-8") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it perhaps better to use _Index.parse_file
here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be. We are only interested in the version
key because the structure of index.json
is unknown at this time. _Index.parse_file
would imply that the structure of index.json
is the same as it is currently, which may not be the case in the future.
src/ert/storage/local_storage.py
Outdated
return False | ||
if version < _LOCAL_STORAGE_VERSION: | ||
return True | ||
raise NotImplementedError("Incompatible ERT Local Storage") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we be more explicit here and say that version > _LOCAL_STORAGE_VERSION
or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your wish is my command
Should these steps be a happy path?
|
I redid the experiment previously defined and now get this:
|
dcd3db2
to
bfc4590
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested also with running es-mda on snake_oil_field with ert version 4.5.6 and then with this branch.
Seems to work.
Stellar work and good to go I think 👍
No description provided.