-
Notifications
You must be signed in to change notification settings - Fork 141
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
Allow configuring bucket location #455
Conversation
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 adding this so quickly.
I would appreciate adding a docstring entry describing this, and that this only applies to bucket creation via mkdir.
Do you think it might make more sense to add the argument to mkdir instead of init? Or maybe, in init we have a default_location, and mkdir also takes an optional location as an override.
Unfortunately, the CI does not have multiple locations available (of course), but we should add variants on the location with mkdir to ensure that the passed arguments are valid.
Thanks for the quick review!
Definitely! I have this in a local commit already and will push this now.
I would prefer having this as part of the
I have added a test case locally and was surprised to see that it fails (all buckets are still created in the US, even though I specify the location differently). That's why I moved the PR back to a draft, until I figure out what's going on here. |
OK, please let me know. |
Location should be one of the keys in this table? https://cloud.google.com/storage/docs/locations#available-locations (if yes, this link should also be in the docstring) |
Yes, I believe so (we will know for certain once the tests are working). And yes, the link is part of the docstring. |
Okay, it's working now. I didn't know about the fake GCS server, which apparently can only create buckets in the |
@martindurant, did you have some time to take a look at this PR already? 😇 |
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.
What is the reason for moving around the code of _list_buckets
?
I think the plan we had would be the best way to finish this off:
- rename to the argument in
__init__
todefault_location
(=None) - allow
_mkdir
to take alocation
argument (=None) - in
_mkdir
, setlocation = location or self.location
, and the rest is the same.
Good question. In my
True, I kind of forgot about this, sorry. I will get to it now. |
ready for review. |
so perhaps it's a good idea to let this information come through to the user too |
actually, you're making a good point here. i was thinking about leaving the API of
it should be okay to do so. I'll get right to it. |
done. again, I'd suggest squashing, as the commit history has turned out to be quite messy, @martindurant. if there's anything else you'd like to see changed, please let me know. |
github seems to be having trouble today, seems like it might take a while for tests to show up. |
yeah, I've also had issues pushing earlier today. |
i think the CI error is related to me creating new
|
It's the GCSFileSystem that is the singleton - if you instantiate with the same arguments, you should get the same instance. The change was to pass |
Closes #454