Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

add option to set file permissions open #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ieee8023
Copy link

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)

@pep8speaks
Copy link

Hello @ieee8023! Thanks for submitting the PR.

Line 284:1: W293 blank line contains whitespace
Line 285:13: E266 too many leading '#' for block comment
Line 289:22: E231 missing whitespace after ','
Line 289:24: E231 missing whitespace after ','
Line 290:31: E231 missing whitespace after ','
Line 291:1: W293 blank line contains whitespace
Line 313:1: W293 blank line contains whitespace
Line 314:21: E266 too many leading '#' for block comment
Line 318:30: E231 missing whitespace after ','
Line 318:32: E231 missing whitespace after ','
Line 319:39: E231 missing whitespace after ','
Line 320:1: W293 blank line contains whitespace
Line 827:1: W293 blank line contains whitespace
Line 832:1: W293 blank line contains whitespace
Line 837:1: W293 blank line contains whitespace
Line 947:9: E722 do not use bare except'

Copy link
Owner

@fvisin fvisin left a 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
Copy link
Owner

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')
Copy link
Owner

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":
Copy link
Owner

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants