-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Using futures in batched requests #812
Conversation
Changes Unknown when pulling b50d446 on dhermes:add-future-type into * on GoogleCloudPlatform:master*. |
527cfd1
to
f2a9c7d
Compare
@tseaver As with #810 I have replaced the original contents from this and placed them in https://github.com/dhermes/gcloud-python/tree/add-future-type-OLD I was still not able to avoid having each of def set_future_value(self, value):
...
if self.owner is not None:
self.owner._properties = value and from def _set_properties(self, value):
...
if hasattr(value, 'owner'):
value.owner = self |
f2a9c7d
to
ce9e260
Compare
Changes Unknown when pulling ce9e260 on dhermes:add-future-type into * on GoogleCloudPlatform:master*. |
:param value: The properties to be set. | ||
""" | ||
self._properties = value | ||
if hasattr(value, 'owner'): | ||
value.owner = self |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@tseaver Bump |
ce9e260
to
b1e4f7d
Compare
@tseaver PTAL. I added two new commits to move towards what we discussed earlier. I'll likely finalize the 4 commits into 1 or 2 once we've finished review, but wanted to keep the "history" of ideas around. Note that still "unsupported" are:
|
Ugh, sorry -- those comments are on the individual commits. |
@@ -219,6 +225,10 @@ def _do_request(self, method, url, headers, data): | |||
:type data: string | |||
:param data: The data to send as the body of the request. | |||
|
|||
:type dummy: object or :class:`NoneType` | |||
:param dummy: Unused ``target_object`` here but may be used | |||
by a superclass. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
LGTM |
@tseaver We still have some pending discussion points. Things to resolve:
Also, are you OK with me squashing into fewer ad-hoc commits here or should I submit a new PR? |
@tseaver PTAL |
The superclass defines the contract for overridable methods: it must use the same argument names as the ones in the subclasses. This would be another case for an exception to the line-markers (assuming we don't want to disable the check altogether, which is reasonable in my mind for arguments, as opposed to locals defined in the suite).
I remain pretty unconvinced of the utility of any GET methods in a batch, so I'm fine with disabling the "collection GET" (or crippling them) inside a batch.
I'm not sure we have a good story at all for how applications would use GET requests inside a batch.
I'm not fussy about the number of commits in a PR: I certainly wouldn't submit a new one just to clean up history. If squashing them makes you feel better about mergeing, I'm OK with it (but it does mean an indefinitely long delay for the merge, given the current Travis delays). |
Also removing limitation on GETs in batch requests.
This is to allow storage.Batch.finish() to update properties on objects from requests.
NOTE: This commit made for review but will be folded into originals before merged.
Had to trade-off here and use `# pylint: disable=unused-argument`.
Changes Unknown when pulling 4564992 on dhermes:add-future-type into * on GoogleCloudPlatform:master*. |
Using futures in batched requests
@tseaver I just merged, we can continue the discussion when dealing with crippling the iterators. You never mentioned if the behavior of |
Hmm, why doesn't the comment in |
Oversight. My bad. |
Gonna wrap it into the PR for turning off batching for iterators. |
Has #810 as diffbase.@tseaver Note this does not support the
Iterator
subclasses, but I have tested with a fair amount of other requests.It does enable
GET
requests, but does so in a somewhat incomplete way.The main issues are
Iterator.get_next_page_response
fails when
response
is a_Future
2. In
_BucketIterator.get_items_from_response
fails when
response
is a_Future
The first is easy to deal with (e.g.
hasattr(response, 'get')
) but the second is not as easy because we need to start ananditerator before knowing what will end up in the response.