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

Fix duplicate download (#450) #477

Merged
merged 6 commits into from
Nov 26, 2019

Conversation

jessebrennan
Copy link
Collaborator

Fixes race in file download where the file in the filestore could be overwritten, which would leave a dangling link to the file outside the filestore and thus a duplicate file.

@jessebrennan jessebrennan force-pushed the issues/jessebrennan/450-dup-download branch 2 times, most recently from e7af521 to efeac6d Compare November 1, 2019 20:48
@codecov-io
Copy link

codecov-io commented Nov 1, 2019

Codecov Report

Merging #477 into master will increase coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #477      +/-   ##
==========================================
+ Coverage   85.54%   85.67%   +0.13%     
==========================================
  Files          42       42              
  Lines        1895     1906      +11     
==========================================
+ Hits         1621     1633      +12     
+ Misses        274      273       -1
Impacted Files Coverage Δ
hca/dss/util/__init__.py 95.23% <100%> (+1.68%) ⬆️
hca/dss/__init__.py 90.41% <100%> (+0.27%) ⬆️

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 832a0c2...8c4b0f2. Read the comment docs.

Copy link
Contributor

@hannes-ucsc hannes-ucsc left a comment

Choose a reason for hiding this comment

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

Test fail. I prefer not to review before tests pass.

@jessebrennan jessebrennan force-pushed the issues/jessebrennan/450-dup-download branch 2 times, most recently from 67ef538 to 4e3ef4e Compare November 15, 2019 17:25
@jessebrennan
Copy link
Collaborator Author

@hannes-ucsc tests were failing due to a flaky test. An issue has been created #490

hca/dss/__init__.py Outdated Show resolved Hide resolved
hca/dss/util/__init__.py Outdated Show resolved Hide resolved
test/unit/test_dss_client.py Outdated Show resolved Hide resolved
test/unit/test_dss_client.py Outdated Show resolved Hide resolved
@hannes-ucsc hannes-ucsc removed their assignment Nov 22, 2019
@jessebrennan jessebrennan force-pushed the issues/jessebrennan/450-dup-download branch from 2d0c1c1 to 60520a4 Compare November 23, 2019 04:46
@jessebrennan jessebrennan force-pushed the issues/jessebrennan/450-dup-download branch from 60520a4 to d4d48ed Compare November 25, 2019 22:16
@jessebrennan
Copy link
Collaborator Author

@hannes-ucsc in order to facilitate resolution of merge conflicts during rebasing, I had to squash the PR. I kept the review changes from your latest review as separate fixup! commits. I also added a couple new commits to address some broken tests.

@@ -17,5 +23,34 @@ def test_dict_merge(self):
dict3 = {'a': {'b': {'c': 1, 'd': 1}}, 'c': 2, 'd': 2}
self.assertEqual(hca.util._merge_dict(dict1, dict2), dict3)


class TestLinking(TmpDirTestCase):
"""TmpDirTestCase will ensure any links / files we create are cleaned up"""
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like one-liner docstrings because I like the vertical space introduced by the two lines with just triple quotes on them. But there is no clear guide for this repo so I'll leave this to you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since this format of docstring is still PEP 8, I think it is acceptable to leave it as is.

@hannes-ucsc
Copy link
Contributor

Merge at will.

@hannes-ucsc hannes-ucsc removed their assignment Nov 25, 2019
We want downloads to not overwrite files in the filestore, otherwise we
risk overwriting a copy that is already linked elsewhere and thus
creating a redundant copy from the old link. Instead, fail to write, but
don't complain. This insures we use the filestore copy that already
exists.
There's no reason not to set it, and it makes debugging some failures
easier.
@jessebrennan jessebrennan force-pushed the issues/jessebrennan/450-dup-download branch from d4d48ed to 8c4b0f2 Compare November 25, 2019 23:57
@jessebrennan jessebrennan merged commit 22172e6 into master Nov 26, 2019
@jessebrennan jessebrennan deleted the issues/jessebrennan/450-dup-download branch November 26, 2019 04:05
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