-
Notifications
You must be signed in to change notification settings - Fork 63
add option to set file permissions open #19
base: master
Are you sure you want to change the base?
Conversation
Hello @ieee8023! Thanks for submitting the PR.
|
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.
Hey Joseph, thank you for the PR and sorry for taking so long to check it out!! Can you please fix the PEP8 errors and the the few things I highlighted? Thanks!
@@ -1,5 +1,6 @@ | |||
[general] | |||
datasets_local_path = /the/local/path/where/the/datasets/will/be/copied | |||
open_permissions = False |
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.
Can you rename it to something more self-explanatory, e.g., set_local_paths_readable
or make_local_paths_readable
and add a comment to specify that it will work on Linux (according to https://docs.python.org/2/library/os.html#os.chmod).
@classproperty | ||
def is_open_permissions(self): | ||
config_parser = self.__config_parser__ | ||
return config_parser.get('general', 'open_permissions') |
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.
Please return a boolean with config_parser.get('general', 'open_permissions') in ['True', 'true']
and update the property name according to the config flag name you choose.
@@ -302,6 +310,14 @@ def __init__(self, | |||
if realpath(self.path) != realpath(self.shared_path): | |||
shutil.rmtree(self.path) | |||
shutil.copytree(self.shared_path, self.path) | |||
|
|||
## to make folder shared for others on same filesystem | |||
if self.is_open_permissions == "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.
Check for the boolean if self.is_open_permissions:
(see comment below)
I extended Adriana's initial fix for shared file systems to be an option that is disabled by default so that it can be included in the main code and controlled with a parameter in config.ini.
This will solve a headache when working on a project with more than one person and trying to not waste time and space copying datasets to each machine in a cluster.
As well as changing the permissions on the dataset it also changes them on the higher level folder. This solves the issue if the folder is created by another user (who has a umask to not share the folder)