Skip to content

Conversation

@dberenbaum
Copy link
Contributor

Fixes #8757. Feel free to close and take a different approach. Trying to find a quick fix that will make non-cached external outputs work as expected.

@dberenbaum dberenbaum requested review from daavoo and efiop June 9, 2023 18:12
@codecov
Copy link

codecov bot commented Jun 9, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (621fe07) 90.53% compared to head (e7723a7) 90.53%.

❗ Current head e7723a7 differs from pull request most recent head 931b35a. Consider uploading reports for the commit 931b35a to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9574   +/-   ##
=======================================
  Coverage   90.53%   90.53%           
=======================================
  Files         471      471           
  Lines       36068    36074    +6     
  Branches     5185     5185           
=======================================
+ Hits        32654    32660    +6     
  Misses       2823     2823           
  Partials      591      591           
Impacted Files Coverage Δ
dvc/output.py 84.77% <100.00%> (ø)
tests/func/repro/test_repro.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dberenbaum dberenbaum marked this pull request as draft June 15, 2023 18:39
@dberenbaum dberenbaum force-pushed the output-recursive-false branch from e78c274 to 542d9df Compare June 20, 2023 18:32
@dberenbaum dberenbaum marked this pull request as ready for review June 20, 2023 19:54
@dberenbaum
Copy link
Contributor Author

It looks like the remaining failing tests are unrelated.

dvc/output.py Outdated

def remove(self, ignore_remove=False):
self.fs.remove(self.fs_path, recursive=True)
self.fs.remove(self.fs_path, recursive=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've discussed this before, but it loks wrong. E.g. imagine a directory with files as an output, this will error-out (at least unless I'm missing something). Could you elaborate on the problem that you are trying to solve, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what the test tries to cover unless I'm misunderstanding you, but we probably do need to test it across other filesystems.

The problem is in #8757 - the recursive call errors out for a nonexistent path in s3fs.

As mentioned above, I don't mind closing if we come up with a different approach to solve it in s3fs or fsspec, but wanted to open it for discussion as a potential quick fix.

Copy link
Contributor

@efiop efiop Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are spot on in your explanation in the issue. localfs is ignoring that flag (looks like our oversight) and since all other filesystems would also raise FileNotFoundError, we should just catch and ignore FileNotFoundError here as well.

Suggested change
self.fs.remove(self.fs_path, recursive=False)
try:
self.fs.remove(self.fs_path, recursive=True)
except FileNotFoundError:
pass

The test you've added could be removed or kept around. Ideally, we would test external outputs in dvc.testing, but that will probably just have to wait for better times.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test will become relevant once we make our localfs comply with the flag, but IIRC there are a few more places that need to be fixed along the way, so that could wait.

@efiop efiop merged commit f28d5ee into main Jun 20, 2023
@efiop efiop deleted the output-recursive-false branch June 20, 2023 22:33
@efiop efiop changed the title output: set remove to recursive=false output: remove: catch FileNotFoundError Jun 20, 2023
@efiop
Copy link
Contributor

efiop commented Jun 20, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

external outputs: broken if pipeline output doesn't exist during stage initialization

2 participants