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: add naive objects transfer function #64

Merged
merged 1 commit into from Jun 22, 2022
Merged

transfer: add naive objects transfer function #64

merged 1 commit into from Jun 22, 2022

Conversation

skshetry
Copy link
Member

@skshetry skshetry commented Jun 20, 2022

This implements a very naive transfer mechanism without
batching (which should be a straightforward change after
we have batching in odb.add itself).

@codecov-commenter
Copy link

codecov-commenter commented Jun 20, 2022

Codecov Report

Merging #64 (c67b1f0) into main (488c15f) will increase coverage by 2.84%.
The diff coverage is 90.90%.

@@            Coverage Diff             @@
##             main      #64      +/-   ##
==========================================
+ Coverage   50.70%   53.55%   +2.84%     
==========================================
  Files          35       37       +2     
  Lines        2043     2065      +22     
  Branches      243      245       +2     
==========================================
+ Hits         1036     1106      +70     
+ Misses        987      930      -57     
- Partials       20       29       +9     
Impacted Files Coverage Δ
src/dvc_objects/transfer.py 85.71% <85.71%> (ø)
tests/test_transfer.py 100.00% <100.00%> (ø)
src/dvc_objects/fs/path.py 37.36% <0.00%> (+1.09%) ⬆️
src/dvc_objects/fs/base.py 53.67% <0.00%> (+2.57%) ⬆️
src/dvc_objects/fs/callbacks.py 75.67% <0.00%> (+2.70%) ⬆️
src/dvc_objects/db.py 44.73% <0.00%> (+14.47%) ⬆️
src/dvc_objects/fs/generic.py 41.02% <0.00%> (+23.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 488c15f...c67b1f0. Read the comment docs.

src/dvc_objects/transfer.py Outdated Show resolved Hide resolved


def transfer(
src: "ObjectDB", dest: "ObjectDB", oids: Set["str"], jobs: int = None
Copy link
Member Author

Choose a reason for hiding this comment

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

There's a question of how oids will be discovered by the caller. I guess it's a responsibility of odb.

See iterative/dvc#7874.

from .db import ObjectDB


def transfer(
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm thinking about whether we even need this function. Based on how we calculate status on dvc-data side, the logic here will not be reusable there. Although, this will be useful for the naive transfer of objects.

@skshetry skshetry force-pushed the transfer branch 2 times, most recently from f111f03 to 23a7cc4 Compare June 22, 2022 11:47
@skshetry skshetry changed the title [WIP] transfer: add transfer func transfer: add naive transfer function Jun 22, 2022
@skshetry skshetry changed the title transfer: add naive transfer function transfer: add naive objects transfer function Jun 22, 2022
@skshetry skshetry requested a review from efiop June 22, 2022 11:48
Comment on lines +18 to +21
for oid in new:
path = src.oid_to_path(oid)
dest.add(path, src.fs, oid)
Copy link
Member Author

@skshetry skshetry Jun 22, 2022

Choose a reason for hiding this comment

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

Will add batching support, as soon as ObjectDB.add gets batching support.

This implements a very naive transfer mechanism without
batching (which should be a straightforward change after
we have batching in odb.add itself).
@efiop efiop merged commit 4f0cf3c into main Jun 22, 2022
@skshetry skshetry deleted the transfer branch June 22, 2022 12:06
@efiop efiop mentioned this pull request Jun 24, 2022
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.

None yet

3 participants