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
Fix temporary file permission issue in LogReport #4528
Conversation
fa9b4b3
to
6ca4514
Compare
LGTM! |
chainer/utils/__init__.py
Outdated
try: | ||
yield temp_dir | ||
finally: | ||
shutil.rmtree(temp_dir, ignore_errors=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.
Is it safe to ignore errors? (c.f. tempfile.TemporaryDirectory
raise error when failure of cleanup: https://github.com/python/cpython/blob/3.6/Lib/tempfile.py#L777-L811)
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.
I agree.
I made it optional and False
by default.
LGTM! @okuta Test passed. Could you merge? |
…report Fix temporary file permission issue in LogReport
Fixed the same issue as #4461.
This kind of use of temporary directory is very common, so I made a context manager as
utils.tempdir()
, and applied to all such instances.