Skip to content

Commit

Permalink
DEP: Always compute md5 for aggregated objects (#845)
Browse files Browse the repository at this point in the history
  • Loading branch information
tnatt authored Oct 11, 2024
1 parent c53ebac commit f97153d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion docs/src/dataio_3_migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ Changes to input arguments

Changes to method arguments
- The ``skip_null`` argument to ``generate_metadata()`` is deprecated. It is redundant and can be removed.

- The ``compute_md5`` argument to ``generate_metadata()`` is deprecated and can be removed, as
an MD5 checksum is always computed by default.

Deprecated methods
- The ``generate_aggregation_metadata()`` method is deprecated. Replace it with the identical
``generate_metadata()`` method instead.
14 changes: 9 additions & 5 deletions src/fmu/dataio/aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ def _set_metadata(
type(self.aggregation_id),
)

if not compute_md5:
warnings.warn(
"Using the 'compute_md5=False' option to prevent an MD5 checksum "
"from being computed is now deprecated. This option has no longer "
"an effect and will be removed in the near future.",
UserWarning,
)

if self.aggregation_id is None:
self.aggregation_id = self._generate_aggr_uuid(uuids)
else:
Expand Down Expand Up @@ -258,11 +266,7 @@ def _set_metadata(
template["file"] = {
"relative_path": str(relpath),
"absolute_path": str(abspath) if abspath else None,
"checksum_md5": (
None
if not compute_md5
else _utils.compute_md5_using_temp_file(obj, objdata.extension)
),
"checksum_md5": _utils.compute_md5_using_temp_file(obj, objdata.extension),
}

# data section
Expand Down

0 comments on commit f97153d

Please sign in to comment.