-
Notifications
You must be signed in to change notification settings - Fork 80
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
Refactor purge function #837
Refactor purge function #837
Conversation
Should we simply remove purge_filepaths? it's only used in a function that is not used any more |
It can be useful for #814 |
As long as it is correctly working and being used somewhere else, then On (Feb-10-15| 4:04), Antonio Gonzalez wrote:
|
SELECT sequence_filepath FROM qiita.reference UNION | ||
SELECT taxonomy_filepath FROM qiita.reference UNION | ||
SELECT tree_filepath FROM qiita.reference)""") | ||
WHERE filepath_id NOT IN (%s)""" % union_str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also make sure the files are legitimately deleted off the filesystem at the time of database removal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 724-739
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, not part of request so didn't see it. Carry on.
Pull from upstream master. |
Note that @josenavas and I are checking why these changes do not work in my machine, we have some ideas but we are not sure yet. So please do not merge. |
@antgonza this is ready for review. I fixed the issue. For other @biocore/qiita-dev, the issue is that when you're using the SQL operator |
This now _actually_ works well, thanks for fixing. 👍
|
Thanks @antgonza !! Another reviewer? |
@@ -421,6 +422,68 @@ def test_purge_filepaths(self): | |||
self.assertTrue(exists(fp1)) | |||
self.assertFalse(exists(fp_exp_id)) | |||
|
|||
def test_purge_filepaths_null_cols(self): | |||
"""Tests the nulls vs not in issue in purge_filepaths""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this docstring mean? ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an issue using the SQL command NOT IN
if the list contains null values. There is a link in line 428 with more information. It was for clarity, but I think I did not achieve that; so I'm going to remove the docstring and leave only the comment with the link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh, now I understand the phrasing of the docstring. Thanks!
On (Feb-13-15|13:07), josenavas wrote:
@@ -421,6 +422,68 @@ def test_purge_filepaths(self):
self.assertTrue(exists(fp1))
self.assertFalse(exists(fp_exp_id))
- def test_purge_filepaths_null_cols(self):
"""Tests the nulls vs not in issue in purge_filepaths"""
There is an issue using the SQL command
NOT IN
if the list contains null values. There is a link in line 428 with more information. It was for clarity, but I think I did not achieve that; so I'm going to remove the docstring and leave only the comment with the link
Reply to this email directly or view it on GitHub:
https://github.com/biocore/qiita/pull/837/files#r24696798
A few comments, looks in good shape. The one thing that struck my attention was how complex the test method is, I would advise breaking it down into individual cases, but there's no reason why this should be a blocking comment. |
The method is quite complex, but is not testing multiple things. It is only testing one execution of the |
This should be ready for re-re-re....-review! I've simplified tests and written a new function. It turns out that we already have unlinked files on the test database so I did not need to add a new unlinked file. Also, there was a bug on the fp removal, which is interesting since it was working before... |
This looks good, thanks for making these changes @josenavas 👍 On (Feb-17-15|17:45), Coveralls wrote:
|
@@ -612,6 +612,28 @@ def get_mountpoint(mount_type, conn_handler=None, retrieve_all=False): | |||
return [(d, join(basedir, m, s)) for d, m, s in result] | |||
|
|||
|
|||
def get_mountpoint_path(mount_id, conn_handler=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be confused with get_mountpoint, perhaps change to get_mountpoint_path_by_id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@josenavas, it looks like there are some flake8 problems, may be related to a newer version of flake8. Not your code, it's from the codebase in general. |
Yes, I just saw them. I will try to fix them here, as the PR is ready to go... |
@ElDeveloper @antgonza the issues due to the new version of pep8 should have been solved with my last commit. |
@ElDeveloper @antgonza any remaining comment? |
Fixes (partially) #834
Some tables where missing on the
purge_filepaths
function. Now these tables are fetched programmatically, so this issue should not arise again.Also, there was a line that should not be there at all, so I removed it. I'm actually surprise that the code was working with that line in there. The function
move_filepaths_to_upload_folder
also has that line added, so I removed it too.