From f97153d2b6c0734b5a41e1b4e976a9144df767b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Therese=20Natter=C3=B8y?= <61694854+tnatt@users.noreply.github.com> Date: Fri, 11 Oct 2024 08:56:22 +0200 Subject: [PATCH] DEP: Always compute md5 for aggregated objects (#845) --- docs/src/dataio_3_migration.rst | 4 +++- src/fmu/dataio/aggregation.py | 14 +++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/src/dataio_3_migration.rst b/docs/src/dataio_3_migration.rst index 7f0fd2bbb..71bf19a57 100644 --- a/docs/src/dataio_3_migration.rst +++ b/docs/src/dataio_3_migration.rst @@ -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. diff --git a/src/fmu/dataio/aggregation.py b/src/fmu/dataio/aggregation.py index 48185a18d..5b668b52d 100644 --- a/src/fmu/dataio/aggregation.py +++ b/src/fmu/dataio/aggregation.py @@ -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: @@ -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