GeezerVison is showing github.com — Add support for batch requests in gcloud.storage · Issue #15 · googleapis/google-cloud-python
Add support for batch requests in gcloud.storage #15DescriptionOr wait for the new primitive client that simplifies this. Activitytseaver commented on Nov 7, 2014 Is there a server-side API feature that this issue refers to? silvolu commented on Nov 7, 2014 tseaver commented on Nov 7, 2014 Cool, I had missed that doc. silvolu commented on Nov 7, 2014 It's kinda easy to get lost in the Cloud Encyclopedia :D tseaver commented on Nov 8, 2014 I think we would end up implementing this by subclassing Connection, overriding api_request such that it stored params for non-idempotent HTTP requests (anything other than GET) (similar to the Transaction's mutation in datastore).
I don't know how it should handle interleaving reads: write-after-read can lead to inconsistent state without some help from the server to isolate other changes.
Another approach would be to use a pattern like #352, where the context manager hooks api_request to defer the writes. tseaver commented on Feb 12, 2015 dhermes commented on Feb 12, 2015 tseaver commented on Feb 26, 2015 @dhermes, I'll hold off on the third point until your work on #632 clarifies (I think we would be stepping all over each other there). dhermes commented on Feb 26, 2015 OK cool. I sent the first PR of the oncoming flood (I haven't written the flood yet, I just know it's coming). dhermes commented on Mar 9, 2015 @tseaver I checked and verified that GET requests can be sent as part of batch requests.
In order to accommodate this, we'd need to create a container object (maybe called Future, as in ndb) that we could hold onto and then populate when the batch returns.
For example:
>>> future_bucket = batch.get_bucket('BOGUS.NAME')
>>> future_bucket
<FutureBucket>
>>> future_bucket.get()
Traceback (most recent call last):
...
ValueError: Batch not finished yet.
>>>
>>> batch.finish()
>>> bucket = future_bucket.get()
>>> bucket
<Bucket: BOGUS.NAME>
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|