-
Notifications
You must be signed in to change notification settings - Fork 70
Description
Hi I have a general question on how the uploading to cloudpath works.
My current understanding it this:
When you path.open("w") as f where path is a cloudpath, it just streams the data into a local temporary file somewhere on your local FS. And within the cloudpath.open functions it wraps the buffer.close method with the custom implementation which uploads the temporaryfile to the cloud when the stream is closed.
maybe this is a general python question, but how does it enforce that the .close() function is actually called in the event of the program terminating unexpectedly?
Is it the user's responsibility to either wrap it in a context manager in a with ... block to ensure that the _patched_close_upload is properly called in an event of an program exit?
In a nutshell, how do I ensure that the file actually is written to cloud under all circumstances?
Forgive me if its a silly question, any pointers are greatly appreciated :)