Skip to content
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

transfer: callback: do not set sizes, do it in odb.add() #208

Merged
merged 1 commit into from
May 12, 2023

Conversation

skshetry
Copy link
Member

@skshetry skshetry commented May 12, 2023

The transfer() api should not set sizes, as it's a responsibility of the caller. transfer() could be called with just one file to transfer, so a callback of size 1 does not make sense.

This broke checkout as it checks out one by one.

Related iterative/dvc#6226.

Current dependencies on/for this PR:

@skshetry skshetry requested review from pmrowla and efiop May 12, 2023 09:37
@skshetry skshetry changed the title transfer: callback: do not set sizes, do it in odb.add(). transfer: callback: do not set sizes, do it in odb.add() May 12, 2023
The transfer() api should not set sizes, as it's a responsibility of the caller.
`transfer()` could be called with just one file to transfer, so a callback of size 1
does not make sense.

This broke `checkout` as it checks out one by one.

See iterative/dvc#6226
@skshetry skshetry force-pushed the fix-checkout-callback branch from 04883f4 to 3e1248f Compare May 12, 2023 09:46
@codecov-commenter
Copy link

codecov-commenter commented May 12, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (8dfef0b) 64.54% compared to head (3e1248f) 64.54%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #208   +/-   ##
=======================================
  Coverage   64.54%   64.54%           
=======================================
  Files          25       25           
  Lines        1932     1932           
  Branches      302      302           
=======================================
  Hits         1247     1247           
  Misses        630      630           
  Partials       55       55           
Impacted Files Coverage Δ
src/dvc_objects/fs/generic.py 26.77% <ø> (-0.40%) ⬇️
src/dvc_objects/db.py 93.50% <100.00%> (+0.03%) ⬆️

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

@@ -172,6 +172,9 @@ def _on_error(_from_p: str, _to_p: str, exc: BaseException):

from_paths, to_oids = zip(*to_add)
jobs: Optional[int] = kwargs.get("batch_size", kwargs.get("jobs"))

callback.set_size(len(from_paths))
Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally, this should be handled by the caller of odb.add().

@efiop efiop merged commit 33e4d8f into main May 12, 2023
@skshetry skshetry deleted the fix-checkout-callback branch May 12, 2023 10:45
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.

3 participants