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

IrodsConnector:download_data : Collection name is created dubbel #57

Open
chStaiger opened this issue Jan 11, 2023 · 2 comments
Open

IrodsConnector:download_data : Collection name is created dubbel #57

chStaiger opened this issue Jan 11, 2023 · 2 comments

Comments

@chStaiger
Copy link
Collaborator

When downloading an iRODS connection the collection name is created twice as a nested directory on the destination:

Downloading a collection without any subcollections

coll_path = "/nluu12p/home/vault-test-christine/Downloads"
coll = ic.session.collections.get(coll_path)
print(coll.subcollections)
Out[20]: []

The actual download

ic.download_data(coll, "/Users/staig001/testDownload/", 10)

And its result:

tree /Users/staig001/testDownload/
/Users/staig001/testDownload/
└── Downloads
    └── Downloads
        ├── file1.txt
        ├── file2.txt
        ├── ...

I also see that the diffs are not calculated correctly.
All checked on Mac.

@chStaiger
Copy link
Collaborator Author

I found the issue, in https://github.com/rijksuniversiteit-groningen/iBridges/blob/73de38159c3e99654584e77137989245ef8a5722/utils/IrodsConnector.py#L1038:

        if diffs is None:
            dst_path= dst_path.joinpath(src_path.name)
            if self.is_dataobject(src_obj):
                diff, _, only_irods, _ = self.diffObjFile(
                    src_path, dst_path, scope="checksum")

the variable dst_path is extended with the name of the collection to download. It is needed to compare data, but for the download itself the original dst_path as presented as argument to the function is needed.

The bug can be fixed with:

        if diffs is None:
            dst_path_compare = dst_path.joinpath(src_path.name)
            if self.is_dataobject(src_obj):
                diff, _, only_irods, _ = self.diffObjFile(
                    src_path, dst_path_compare, scope="checksum")

@jpmcfarland
Copy link
Collaborator

Thanks! I will have a look when I get the chance.

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

No branches or pull requests

2 participants