Error "google.api_core.exceptions.DeadlineExceeded: 504 Deadline Exceeded" has occurred

3,255 views
Skip to first unread message

今村由貴

unread,
Sep 5, 2019, 11:01:31 AM9/5/19
to Google Cloud Translation API

Please help me to resolve the error

 

I followed the instruction below,

https://cloud.google.com/translate/docs/quickstart-client-libraries-v3

and when I run the following code, I encounter the error that says "google.api_core.exceptions.DeadlineExceeded: 504 Deadline Exceeded" at “target_language_code” in the script.

 

Here is the code that I used.

from google.cloud import translate_v3beta1 as translate
client = translate.
TranslationServiceClient()

# project_id = YOUR_PROJECT_ID
# text = 'Text you wish to translate'
location =
'global'

parent = client.location_path(project_id, location)

response = client.translate_text(
    parent=parent,
    contents=[text],
    mime_type=
'text/plain',  # mime types: text/plain, text/html
    source_language_code=
'en-US',
    target_language_code=
'sr-Latn')

for translation in response.translations:
   
print('Translated Text: {}'.format(translation))

 

Here is the trace log that I received.

 

Traceback (most recent call last):

  File "C:\Program Files\Python36\lib\site-packages\google\api_core\grpc_helpers.py", line 57, in error_remapped_callable

    return callable_(*args, **kwargs)

  File "C:\Program Files\Python36\lib\site-packages\grpc\_channel.py", line 565, in __call__

    return _end_unary_response_blocking(state, call, False, None)

  File "C:\Program Files\Python36\lib\site-packages\grpc\_channel.py", line 467, 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":"@1567597238.887000000","description":"Deadline Exceeded","file":"src/core/ext/filters/deadline/deadline_filter.cc","file_line":69,"grpc_status":4}"

> 

 

The above exception was the direct cause of the following exception:

 

Traceback (most recent call last):

  File "c:\Users\h1015543\.vscode\extensions\ms-python.python-2019.8.30787\pythonFiles\ptvsd_launcher.py", line 43, in <module>

    main(ptvsdArgs)

  File "c:\Users\h1015543\.vscode\extensions\ms-python.python-2019.8.30787\pythonFiles\lib\python\ptvsd\__main__.py", line 432, in main

    run()

  File "c:\Users\h1015543\.vscode\extensions\ms-python.python-2019.8.30787\pythonFiles\lib\python\ptvsd\__main__.py", line 316, in run_file

    runpy.run_path(target, run_name='__main__')

  File "C:\Program Files\Python36\lib\runpy.py", line 263, in run_path

    pkg_name=pkg_name, script_name=fname)

  File "C:\Program Files\Python36\lib\runpy.py", line 96, in _run_module_code

    mod_name, mod_spec, pkg_name, script_name)

  File "C:\Program Files\Python36\lib\runpy.py", line 85, in _run_code

    exec(code, run_globals)

  File "c:\Users\h1015543\Documents\Python-study\v3beta1\test.py", line 15, in <module>

    target_language_code='aaaaaaaa')

  File "C:\Program Files\Python36\lib\site-packages\google\cloud\translate_v3beta1\gapic\translation_service_client.py", line 338, in translate_text

    request, retry=retry, timeout=timeout, metadata=metadata

  File "C:\Program Files\Python36\lib\site-packages\google\api_core\gapic_v1\method.py", line 143, in __call__

    return wrapped_func(*args, **kwargs)

  File "C:\Program Files\Python36\lib\site-packages\google\api_core\retry.py", line 273, in retry_wrapped_func

    on_error=on_error,

  File "C:\Program Files\Python36\lib\site-packages\google\api_core\retry.py", line 182, in retry_target

    return target()

  File "C:\Program Files\Python36\lib\site-packages\google\api_core\timeout.py", line 214, in func_with_timeout

    return func(*args, **kwargs)

  File "C:\Program Files\Python36\lib\site-packages\google\api_core\grpc_helpers.py", line 59, in error_remapped_callable

    six.raise_from(exceptions.from_grpc_error(exc), exc)

  File "<string>", line 3, in raise_from

google.api_core.exceptions.DeadlineExceeded: 504 Deadline Exceeded



I would appreciated if you could give me an advice.

 

Kan Qiao

unread,
Sep 5, 2019, 2:48:56 PM9/5/19
to Google Cloud Translation API
can you send us the content of your request so we can repro it?

今村由貴

unread,
Sep 7, 2019, 12:12:23 PM9/7/19
to Google Cloud Translation API
Thanks, but it is the same one that shows in the page.

This is the second trial for Cloud Translation v3beta1 and it succeeded  before.

Please note that Cloud Translation v2 code works.

the code that I executed below, 

Kan Qiao

unread,
Sep 7, 2019, 12:43:46 PM9/7/19
to Google Cloud Translation API
Have you uncommented the 'project_id' (and replace it with your real project id) and 'text'?

今村由貴

unread,
Sep 8, 2019, 8:08:13 PM9/8/19
to Google Cloud Translation API
Thank you very much for your support.

Yes, I have, but it doesn't work.


今村由貴

unread,
Sep 8, 2019, 8:11:10 PM9/8/19
to Google Cloud Translation API
There may be a missing setting to execute the code successfully but I do not know what it is.

Kan Qiao

unread,
Sep 9, 2019, 12:45:48 PM9/9/19
to Google Cloud Translation API
What is the text you are trying to translate?

今村由貴

unread,
Sep 13, 2019, 6:26:59 AM9/13/19
to Google Cloud Translation API
Dear Kan,

Thank you for your support !

The problem was resolved!

The proxy setting in my company caused the problem.
Reply all
Reply to author
Forward
0 new messages