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

BaseDirectory: fix race condition for os.makedirs() #15

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

Conversation

cjp256
Copy link

@cjp256 cjp256 commented Mar 17, 2021

In the case of parallel usage, there is race between when the
directory is checked and created. To prevent this race, use
exist_ok=True which is supported in python 3.2+.

https://docs.python.org/3/library/os.html#os.makedirs

Signed-off-by: Chris Patterson [email protected]

In the case of parallel usage, there is race between when the
directory is checked and created.  To prevent this race, use
exist_ok=True which is supported in python 3.2+.

https://docs.python.org/3/library/os.html#os.makedirs

Signed-off-by: Chris Patterson <[email protected]>
@cjp256
Copy link
Author

cjp256 commented Mar 17, 2021

Since python 2.7 is EOL, is it desired to continue to support it? If so, we can replace with a try/except block. But I'd hope anyone still on python2.7 has their dependencies pinned down by this point ;) If not, I can PR to drop 2.7 support.

@takluyver
Copy link
Owner

I'm OK with dropping Python 2.7 at this point. Can you update the CI config and the setup.py (both the classifiers list & adding a python_requires field).

@zbentley
Copy link

Is there anything I can do to help get this merged? This issue occasionally affects us in production.

Is the only required change the setup.py/CI configuration?

@takluyver
Copy link
Owner

Yup, I think those are the only required changes. Alternatively, you could make this Python 2 compatible if that's easier (try/except to catch OSError, ignore the exception if e.errno == errno.EEXIST) - whichever is easier.

@zbentley
Copy link

Will this do it? #18

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.

3 participants