Thanks to visit codestin.com
Credit goes to github.com

Skip to content

from_grpc fails with got an unexpected keyword argument 'retry' #87

Closed
@rodis

Description

@rodis

A call to from_grpc fails with

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 seems like it sets _refresh_grpc as self._refresh for the Operation object https://github.com/googleapis/python-api-core/blob/master/google/api_core/operation.py#L299 but when _refresh_and_update is called by done, it gets and passes down to _refresh_grpc a retry param https://github.com/googleapis/python-api-core/blob/master/google/api_core/operation.py#L157 that _refresh_grpc doesn't know how to handle https://github.com/googleapis/python-api-core/blob/master/google/api_core/operation.py#L251 causing the error above.

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_operation https://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.

Metadata

Metadata

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions