-
Notifications
You must be signed in to change notification settings - Fork 84
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
Close temporary files before removal, fix PermissionError #218
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
Hi @pavithrasv - it could be impossible to run TF Cloud on Windows machines at the moment (#123), and this PR provides the fix. Would you have some time to look at it? |
@SinaChavoshi, perhaps? |
This is great, thank you for the PR @christianversloot! I'll take a look at it shortly. |
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.
Thank you for the PR!
|
||
Args: | ||
return_descriptors: Whether to return descriptors as well. | ||
""" |
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 add a returns section to this doc string as well?
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.
os.remove(preprocessed_entry_point) | ||
for f in container_builder.get_generated_files(): | ||
os.remove(f) | ||
for file_path, file_descriptor in container_builder.get_generated_files(return_descriptors=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.
Can you format this so that line length <= 80?
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.
Thanks for your review! Commits have been attached. |
@christianversloot Can you fix some lint errors? Line too long (96/80) [line-too-long] |
@pavithrasv absolutely! Running
|
Hi there, any update? :) |
Fixed a few more lint errors. I will merge this shortly. Thank you and sorry about the wait! |
Fixes #123.
TensorFlow Cloud creates temporary files which it then removes out of neatness reasons, but on Windows a
PermissionError
emerges because the files haven't been closed before removal.This PR fixes the issue by closing the temporary files using their file descriptors before attempting to remove them. In doing so, I attempted to keep the existing definitions backwards compatible by making returning the file descriptors optional.