You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
from_grpc fails with got an unexpected keyword argument 'retry' #87
Traceback (most recent call last):
File "deploy.py", line 43, in <module>
main()
File "deploy.py", line 36, in main
if op.done() == True:
File "/home/rosariod/.virtualenv/automl/lib/python3.6/site-packages/google/api_core/operation.py", line 170, in done
self._refresh_and_update(retry)
File "/home/rosariod/.virtualenv/automl/lib/python3.6/site-packages/google/api_core/operation.py", line 157, in _refresh_and_update
self._operation = self._refresh(retry=retry)
TypeError: _refresh_grpc() got an unexpected keyword argument 'retry'
It might be that the retry param could be correctly handled when the Operation object is created by from_gapic because in that case self._refresh is set to operations_client.get_operationhttps://github.com/googleapis/python-api-core/blob/master/google/api_core/operation.py#L325 which might be aware of the retry param but doesn't seem to be the case for from_grpc and from_http_json.
defget_operation_status(operation_full_id):
"""Get operation status."""# [START automl_get_operation_status]fromgoogle.cloudimportautoml# TODO(developer): Uncomment and set the following variables# operation_full_id = \# "projects/[projectId]/locations/us-central1/operations/[operationId]"client=automl.AutoMlClient()
# Get the latest state of a long-running operation.response=client._transport.operations_client.get_operation(
operation_full_id
)
print("Name: {}".format(response.name))
print("Operation details:")
print(response)
# [END automl_get_operation_status]
Hi @busunkim96, thanks for your reply.
Isn't that more or less what from_gapic does? https://github.com/googleapis/python-api-core/blob/master/google/api_core/operation.py#L326
I guess I could but It feels like client._transport.operations_client.get_operation exposes me to too many internal details of the AutoML library that I shouldn't know about. Wouldn't that make my script rely on an internal variable _transport with a bunch of other details that from_gapic is taking care of for me?
That's a fair point. client.transport used to be public and I'm not quite sure what prompted the change. I opened googleapis/gapic-generator-python#640
As for from_grpc, I'll take a closer look today and get back to you.
The next release of google-cloud-automl will have a public property transport (see change to library templates in googleapis/gapic-generator-python@13cddda). Please use the operations client via _transport for now and switch to transport once the release is made.
Activity
busunkim96 commentedon Oct 6, 2020
Hi @rodis,
Thanks for filing an issue.
google-api-coreandgoogle-cloud-automlare you using?rodis commentedon Oct 6, 2020
hi @busunkim96
versions
google-api-core (1.22.4)
google-cloud-automl (2.0.0)
I just started to use the google-api-core library and I run into the issue as I started to use the
from_grpcfunctionlittle extract from my code
busunkim96 commentedon Oct 7, 2020
Is there a specific reason you're constructing channels and operations manually? It's possible to use the client library to fetch operations:
https://github.com/googleapis/python-automl/blob/v2.0.0/samples/snippets/get_operation_status.py
rodis commentedon Oct 7, 2020
Hi @busunkim96, thanks for your reply.
Isn't that more or less what
from_gapicdoes? https://github.com/googleapis/python-api-core/blob/master/google/api_core/operation.py#L326I guess I could but It feels like
client._transport.operations_client.get_operationexposes me to too many internal details of the AutoML library that I shouldn't know about. Wouldn't that make my script rely on an internal variable_transportwith a bunch of other details thatfrom_gapicis taking care of for me?busunkim96 commentedon Oct 8, 2020
That's a fair point.
client.transportused to be public and I'm not quite sure what prompted the change. I opened googleapis/gapic-generator-python#640As for
from_grpc, I'll take a closer look today and get back to you.rodis commentedon Oct 8, 2020
@busunkim96 Thank you.
busunkim96 commentedon Oct 10, 2020
Hi @rodis,
The next release of
google-cloud-automlwill have a public propertytransport(see change to library templates in googleapis/gapic-generator-python@13cddda). Please use the operations client via_transportfor now and switch totransportonce the release is made.I think your assessment that
_refresh_grpc()doesn't know what to do withrefreshis correct. The problem was likely introduced with 14f1f34#diff-6e22f95d11fd4cc631b3f0f432433561.fix: support 'retry' for ops built from HTTP/gRPC responses
fix: support 'retry' for ops built from HTTP/gRPC responses (#115)