From 910c232077f016e76969a8089d898c9da4784561 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Thu, 29 Jun 2023 13:05:17 +0300 Subject: [PATCH] output: save: error out on cached external outputs (#9672) * output: save: error out on cached external outputs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- dvc/output.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dvc/output.py b/dvc/output.py index 3138fed1b..89a15a6a6 100644 --- a/dvc/output.py +++ b/dvc/output.py @@ -20,6 +20,7 @@ from dvc.exceptions import ( DvcException, MergeError, ) +from dvc.utils import format_link from dvc.utils.objects import cached_property from dvc_data.hashfile import check as ocheck from dvc_data.hashfile import load as oload @@ -678,6 +679,14 @@ class Output: # pylint: enable=no-member def save(self) -> None: + if self.use_cache and not self.is_in_repo: + raise DvcException( + f"Saving cached external output {str(self)} is not supported " + "since DVC 3.0. See " + f"{format_link('https://dvc.org/doc/user-guide/upgrade')} " + "for more info." + ) + if not self.exists: raise self.DoesNotExistError(self)