-
Notifications
You must be signed in to change notification settings - Fork 15
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
ENH: Do not call generate_metadata() on export when config is not valid #793
Conversation
b79e525
to
0fbf4af
Compare
Still export data (without metadata)? |
Yes, no change in today's functionality. Simply a refactoring to find the export path to the object without having to create metadata first. This way we can avoid several checks of the validity of the config, and align the pydantic model used to generate metadata more to the one used for the schema. + users not interested in metadata won't get annoyed by validation errors 👍 So to be clear today we do a pure export of the object if the config is not valid, i.e. no metadata is exported. This is not changed here 🙂 |
e83d1fb
to
68bd6b9
Compare
68bd6b9
to
37a24cc
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.
Any extra mentions needed for the dataio 3.0 migration guide?
Nice job, this is a step in the right direction.
(Had a group review)
if not newsettings: | ||
return | ||
|
||
warnings.warn( |
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.
this warning was just moved since we need to run this _update_check_settings
several places. The entire function can be removed once we move towards fmu.dataio 3.0
outfile = Path(metadata["file"]["absolute_path"]) | ||
# create output folders if they don't exist | ||
outfile.parent.mkdir(parents=True, exist_ok=True) |
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.
Moved inside export_file
@@ -308,16 +397,19 @@ def test_rep_include(globalconfig1, regsurf): | |||
mymeta = exp.generate_metadata(regsurf) | |||
assert mymeta["access"]["ssdl"]["rep_include"] is True | |||
|
|||
# test that rep_include is taken from config if not provided | |||
# test that rep_include is defaulted to false if not provided |
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.
Updated this test since rep_include
no longer is included in the config by default
37a24cc
to
063c027
Compare
Was just in the process of entering it into the migration guide 🙂 should be there now! |
063c027
to
40db19a
Compare
40db19a
to
d12c2f8
Compare
Closes #602
export
function and the config is not valid (i.e. no metadata should be exported)generate_metadata
function saying in the future no metadata will be returned if the config is invalidgenerate_export_metadata,
and removemasterdata
andaccess
as optional fields in the pydantic model used to generate metadata.