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

Refactor purge function #837

Merged
merged 14 commits into from
Feb 18, 2015
Merged

Conversation

josenavas
Copy link
Contributor

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.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 78.44% when pulling 26bb72d on josenavas:refactor-purge-function into 49e2e49 on biocore:master.

@antgonza
Copy link
Member

Should we simply remove purge_filepaths? it's only used in a function that is not used any more

@josenavas
Copy link
Contributor Author

It can be useful for #814

@ElDeveloper
Copy link
Member

As long as it is correctly working and being used somewhere else, then
I'm all in for keeping it, otherwise there's no point.

On (Feb-10-15| 4:04), Antonio Gonzalez wrote:

Should we simply remove purge_filepaths? it's only used in a function that is not used any more


Reply to this email directly or view it on GitHub:
#837 (comment)

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)
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lines 724-739

Copy link
Contributor

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.

@antgonza
Copy link
Member

Pull from upstream master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.17%) to 78.61% when pulling f557296 on josenavas:refactor-purge-function into 49e2e49 on biocore:master.

@antgonza
Copy link
Member

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.

@josenavas
Copy link
Contributor Author

@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 NOT IN, if there is a NULL value on the list to test, the NOT IN will also return a NULL. For more information about the issue, check this link (thanks @antgonza for the useful link!)

@antgonza
Copy link
Member

antgonza commented Feb 13, 2015 via email

@coveralls
Copy link

Coverage Status

Coverage remained the same at 78.5% when pulling 4ca81fd on josenavas:refactor-purge-function into 559556e on biocore:master.

@josenavas
Copy link
Contributor Author

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"""
Copy link
Member

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? ...

Copy link
Contributor Author

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

Copy link
Member

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

@ElDeveloper
Copy link
Member

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.

@josenavas
Copy link
Contributor Author

The method is quite complex, but is not testing multiple things. It is only testing one execution of the purge_filepaths function. Since it is a quite dangerous functionality, I decided to put quite few multiple checks and things that I think that functionality could potentially mess up

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 78.48% when pulling 3a58a90 on josenavas:refactor-purge-function into 559556e on biocore:master.

@josenavas
Copy link
Contributor Author

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...

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 78.36% when pulling 155a9d3 on josenavas:refactor-purge-function into d398414 on biocore:master.

@ElDeveloper
Copy link
Member

This looks good, thanks for making these changes @josenavas 👍

On (Feb-17-15|17:45), Coveralls wrote:

Coverage Status

Coverage increased (+0.01%) to 78.36% when pulling 155a9d3 on josenavas:refactor-purge-function into d398414 on biocore:master.


Reply to this email directly or view it on GitHub:
#837 (comment)

@@ -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):
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@ElDeveloper
Copy link
Member

@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.

@josenavas
Copy link
Contributor Author

Yes, I just saw them. I will try to fix them here, as the PR is ready to go...

@josenavas
Copy link
Contributor Author

@ElDeveloper @antgonza the issues due to the new version of pep8 should have been solved with my last commit.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 78.37% when pulling dba6d64 on josenavas:refactor-purge-function into d398414 on biocore:master.

@josenavas
Copy link
Contributor Author

@ElDeveloper @antgonza any remaining comment?

antgonza added a commit that referenced this pull request Feb 18, 2015
@antgonza antgonza merged commit 557a7dd into qiita-spots:master Feb 18, 2015
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

6 participants