-
Notifications
You must be signed in to change notification settings - Fork 53
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
Rewrite of storage backend using fs #145
Conversation
There are still 3 open TODOs related to setting group permissions, where some input from @Akasch would be appreciated. |
image_file.seek(0) | ||
imageset_dir.upload(img_fname, image_file) | ||
# TODO rfrigg: Check if necessary | ||
# shutil.chown(file_new_path, group=settings.UPLOAD_FS_GROUP) |
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.
@Akasch Can you explain why this is needed? I guess it might be needed for an OS filesystem, but not for a cloud filesystem like GCS. I can look into adding some code that adds this line back in case an OS filesystem is used.
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.
@ftsell Shall we remove these TODOs since you tested everything and it works as expected?
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.
Yes although I'm not 100% sure either, I think it is safe to do so.
I'm closing this PR since there seems to be no interest in contributions. |
It's not that we are not interested but rather that there is currently not much activity because of COVID. I agree that we should have at least responded though. Be assured that it was not meant as a personal offense. I'm reopening this because we still are interested in integrating this feature. |
@ftsell No offense taken :) Thanks for re-opening in this case. |
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.
In general these are really nice improvements and I appreciate the effort you have put in; thank you very much!
I have tested the proposed changes by running manage.py
directly and inside a kubernetes deployment but only with a local file-system. I do not expect cloud based storage to behave any different since that is the whole point of using fs
.
In both scenarios I was able to verify that uploading, downloading, viewing and editing of tools and images work as expected. The zip-daemon threw a minor error which was easily correctable.
I have some minor suggestions which mostly have to do with where settings are stored.
I have also attached patch files which merge master back into your branch and fix the problems/suggestions I have found.
Now many other filesystems like S3 or GCS are supported through the fs filesystem abstraction layer.
previously, the zip-daemon would sometimes run into an error when the tmp-directory for a specific imageset did not already exist. A fix has been included to create the directory in such a case.
47898e2
to
757cb2f
Compare
@ftsell I rebased my branch on the latest master and applied your patch 008 for the zip daemon. Patches 001 until 006 are not different from the commits on master and were automatically introduced because of the rebase. 007 is unrelated to this PR, so I didn't apply it. 009 is about moving things from |
@roman-captural
Not exactly because the additional dependency is only required with the addition of fs. And because you are introducing the dependency to fs in your PR I would very much like to make sure that the application continues to work even in the docker deployment. Opening another PR for improving the settings structure is something I can agree with so you can leave out patch 009 if you want to. |
the dependency was only added to the Dockerfile and not requirements.txt since it is present in non-minimized python environments.
I see, sorry about this. It wasn't clear from the commit message. I added another commit with patch 007 |
@roman-captural
true |
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.
alright; looks fine to me 👍
I spoke with @timonegk and he wanted to do a review as well so that's why this is only a comment and not approval.
Rebasing 1a0264f introduced a small problem in |
Looks great now, thank you for the feature and sorry again for the long delay! |
Thanks for creating imagetagger. It's a great tool. I use it together with Google Cloud Storage and I therefore did a rather large refactoring, abstracting the file storage layer of imagetagger.
Now many other filesystems like S3 or GCS are supported through PyFilesystem2 (see here for a list of supported file systems.)
There were no tests for the file storage layer and I did not write any new ones with this refactoring. I did some manual testing and am successfully using this filesystem abstraction in my Google Cloud deployment. Feel free to write some tests yourself. I might also add some later on.
I thought I contribute this potentially useful change back in case it is useful for other people. However, feel free to adapt or completely reject this pull request.