How do I define 'retry' in Google GoogleAdsService?

487 views
Skip to first unread message

Jayce Li

unread,
Jun 4, 2019, 2:17:38 AM6/4/19
to AdWords API and Google Ads API Forum
Hi, Google Ads

I found when I search query via GoogleAdsService client, sometime would showed up error, but sometime not.

So I decide to write retry function for GoogleAdsService, but have no clue to do.

Could you provide retry example?

Google Ads API Forum Advisor Prod

unread,
Jun 4, 2019, 2:14:48 PM6/4/19
to adwor...@googlegroups.com
Hello Jayce,

To clarify, not every error subjected to retry after some time. If you are facing INTERNAL_ERROR error then you can make the API call again after sometime. Usually when such exception/error occurs, your exception handling/error handling code should sleep for some time and then call the function again to make the API call. That is a general structure to handle exceptions. There is no code samples available to retry error, here is some more details on using exponential backoff policy.

You could also share your error log to see if the errors you are facing are retryable or not. Please use incognito window while sharing the logs.

Regards,
Sai Teja, Google Ads API Team

ref:_00D1U1174p._5001UBlPHr:ref

Jayce Li

unread,
Jun 5, 2019, 4:53:09 AM6/5/19
to AdWords API and Google Ads API Forum

Sometime I will encounter DeadlineExceeded error, this error could be completed successfully after retry.


 
ib/python3.6/site-packages/grpc/_channel.py", line 466, in _end_unary_response_blocking
    raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.DEADLINE_EXCEEDED
details = "Deadline Exceeded"
debug_error_string = "{"created":"@1559723393.267179000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1039,"grpc_message":"Deadline Exceeded","grpc_status":4}"
google.api_core.exceptions.DeadlineExceeded: 504 Deadline Exceeded

Google Ads API Forum Advisor Prod

unread,
Jun 5, 2019, 3:50:52 PM6/5/19
to adwor...@googlegroups.com
Hello Jayce,

Yes, even for DEADLINE_EXCEEDED error you can retry after sometime. As mentioned earlier follow that process to create retry mechanism. We don't have code samples for retrying. Let me know if you have any further questions. 
Reply all
Reply to author
Forward
0 new messages