-
Notifications
You must be signed in to change notification settings - Fork 382
POC: Sketch of localfilesystem and commiting #8
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
Conversation
(and a prod to make the aliases work with docstrings, please :) ) |
Yeah i think that would probably work as a minimal example. I think the interesting thing for distributed filesystems would be to consider making the actual transaction class itself a thing that can be moved around. This is easily achievable by implementers by making fs.transaction() return an object with a Not entirely sure if we want to be as strict by default? |
fsspec/spec.py
Outdated
ac = kwargs.pop('autocommit', not self._intrans) | ||
f = self._open(path, mode=mode, block_size=block_size, | ||
autocommit=ac, **kwargs) | ||
if not ac: |
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.
Should autocommit be necessarily True if _intrans
isn't set, and should we avoid collecting up instances that might never be cleared?
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.
autocommit
only applies to writing at __exit__
so i think its a sane default in terms of user expectations
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.
Thats more explicit. 👍
OK, going to merge this now for further iteration. Of course, it does not yet explicitly deal with distributed transactions, since the file objects within a Transaction are not necessarily pickleable (but they should be, in this context) - however, you would be able to call |
@mariusvniekerk , suggesting here is where you might want to work something out.
This contains minimal stuff for method aliasing (simplest possible), an actual example file-system for local work, and a hacky "transaction" that writes to temporary files, moving to final destination when the transaction is over.
As usual, everything I happened to code here is up for altering or criticism.