GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — translate_v3_batch_translate_text_with_glossary_test: test_batch_translate_text_with_glossary failed · Issue #4239 · GoogleCloudPlatform/python-docs-samples

translate_v3_batch_translate_text_with_glossary_test: test_batch_translate_text_with_glossary failed #4239

New issue
Copy link
New issue
Copy link
Closed
#4357
#4247
Closed
translate_v3_batch_translate_text_with_glossary_test: test_batch_translate_text_with_glossary failed#4239
#4357
#4247
Copy link
Assignees
tmatsuotelpirion
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.

Description

@flaky-bot
flaky-bot
bot
opened on Jul 4, 2020
Issue body actions

This test failed!

To configure my behavior, see the Build Cop Bot documentation.

If I'm commenting on this issue too often, add the buildcop: quiet label and
I will stop commenting.


commit: 51a66f9
buildURL: Build Status, Sponge
status: failed

Test output
target = functools.partial(>)
predicate = .if_exception_type_predicate at 0x7f0d25184400>
sleep_generator = 
deadline = 180, on_error = None
def retry_target(target, predicate, sleep_generator, deadline, on_error=None):
    """Call a function and retry if it fails.

    This is the lowest-level retry helper. Generally, you'll use the
    higher-level retry helper :class:`Retry`.

    Args:
        target(Callable): The function to call and retry. This must be a
            nullary function - apply arguments with `functools.partial`.
        predicate (Callable[Exception]): A callable used to determine if an
            exception raised by the target should be considered retryable.
            It should return True to retry or False otherwise.
        sleep_generator (Iterable[float]): An infinite iterator that determines
            how long to sleep between retries.
        deadline (float): How long to keep retrying the target. The last sleep
            period is shortened as necessary, so that the last retry runs at
            ``deadline`` (and not considerably beyond it).
        on_error (Callable[Exception]): A function to call while processing a
            retryable exception.  Any error raised by this function will *not*
            be caught.

    Returns:
        Any: the return value of the target function.

    Raises:
        google.api_core.RetryError: If the deadline is exceeded while retrying.
        ValueError: If the sleep generator stops yielding values.
        Exception: If the target raises a method that isn't retryable.
    """
    if deadline is not None:
        deadline_datetime = datetime_helpers.utcnow() + datetime.timedelta(
            seconds=deadline
        )
    else:
        deadline_datetime = None

    last_exc = None

    for sleep in sleep_generator:
        try:
          return target()

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:184:


self = <google.api_core.operation.Operation object at 0x7f0d220e70f0>

def _done_or_raise(self):
    """Check if the future is done and raise if it's not."""
    if not self.done():
      raise _OperationNotComplete()

E google.api_core.future.polling._OperationNotComplete

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:84: _OperationNotComplete

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

self = <google.api_core.operation.Operation object at 0x7f0d220e70f0>
timeout = 180

def _blocking_poll(self, timeout=None):
    """Poll and wait for the Future to be resolved.

    Args:
        timeout (int):
            How long (in seconds) to wait for the operation to complete.
            If None, wait indefinitely.
    """
    if self._result_set:
        return

    retry_ = self._retry.with_deadline(timeout)

    try:
      retry_(self._done_or_raise)()

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:104:


args = (), kwargs = {}
target = functools.partial(<bound method PollingFuture._done_or_raise of <google.api_core.operation.Operation object at 0x7f0d220e70f0>>)
sleep_generator = <generator object exponential_sleep_generator at 0x7f0d220c6e08>

@general_helpers.wraps(func)
def retry_wrapped_func(*args, **kwargs):
    """A wrapper that calls target function with retry."""
    target = functools.partial(func, *args, **kwargs)
    sleep_generator = exponential_sleep_generator(
        self._initial, self._maximum, multiplier=self._multiplier
    )
    return retry_target(
        target,
        self._predicate,
        sleep_generator,
        self._deadline,
      on_error=on_error,
    )

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:286:


target = functools.partial(<bound method PollingFuture._done_or_raise of <google.api_core.operation.Operation object at 0x7f0d220e70f0>>)
predicate = <function if_exception_type..if_exception_type_predicate at 0x7f0d25184400>
sleep_generator = <generator object exponential_sleep_generator at 0x7f0d220c6e08>
deadline = 180, on_error = None

def retry_target(target, predicate, sleep_generator, deadline, on_error=None):
    """Call a function and retry if it fails.

    This is the lowest-level retry helper. Generally, you'll use the
    higher-level retry helper :class:`Retry`.

    Args:
        target(Callable): The function to call and retry. This must be a
            nullary function - apply arguments with `functools.partial`.
        predicate (Callable[Exception]): A callable used to determine if an
            exception raised by the target should be considered retryable.
            It should return True to retry or False otherwise.
        sleep_generator (Iterable[float]): An infinite iterator that determines
            how long to sleep between retries.
        deadline (float): How long to keep retrying the target. The last sleep
            period is shortened as necessary, so that the last retry runs at
            ``deadline`` (and not considerably beyond it).
        on_error (Callable[Exception]): A function to call while processing a
            retryable exception.  Any error raised by this function will *not*
            be caught.

    Returns:
        Any: the return value of the target function.

    Raises:
        google.api_core.RetryError: If the deadline is exceeded while retrying.
        ValueError: If the sleep generator stops yielding values.
        Exception: If the target raises a method that isn't retryable.
    """
    if deadline is not None:
        deadline_datetime = datetime_helpers.utcnow() + datetime.timedelta(
            seconds=deadline
        )
    else:
        deadline_datetime = None

    last_exc = None

    for sleep in sleep_generator:
        try:
            return target()

        # pylint: disable=broad-except
        # This function explicitly must deal with broad exceptions.
        except Exception as exc:
            if not predicate(exc):
                raise
            last_exc = exc
            if on_error is not None:
                on_error(exc)

        now = datetime_helpers.utcnow()

        if deadline_datetime is not None:
            if deadline_datetime <= now:
                six.raise_from(
                    exceptions.RetryError(
                        "Deadline of {:.1f}s exceeded while calling {}".format(
                            deadline, target
                        ),
                        last_exc,
                    ),
                  last_exc,
                )

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:206:


value = None, from_value = _OperationNotComplete()

???
E google.api_core.exceptions.RetryError: Deadline of 180.0s exceeded while calling functools.partial(<bound method PollingFuture._done_or_raise of <google.api_core.operation.Operation object at 0x7f0d220e70f0>>), last exception:

:3: RetryError

During handling of the above exception, another exception occurred:

capsys = <_pytest.capture.CaptureFixture object at 0x7f0d2204d6a0>
bucket = <Bucket: tmp-345cb7a7dfce4c27a5116d4e7c04fd3e>
glossary = 'test-8763692c-e018-4ef7-b87e-b4a4df543853'

@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_batch_translate_text_with_glossary(capsys, bucket, glossary):
    translate_v3_batch_translate_text_with_glossary.batch_translate_text_with_glossary(
        "gs://cloud-samples-data/translation/text_with_glossary.txt",
        "gs://{}/translation/BATCH_TRANSLATION_OUTPUT/".format(bucket.name),
        PROJECT_ID,
      glossary,
    )

translate_v3_batch_translate_text_with_glossary_test.py:75:


translate_v3_batch_translate_text_with_glossary.py:68: in batch_translate_text_with_glossary
response = operation.result(180)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:125: in result
self._blocking_poll(timeout=timeout)


self = <google.api_core.operation.Operation object at 0x7f0d220e70f0>
timeout = 180

def _blocking_poll(self, timeout=None):
    """Poll and wait for the Future to be resolved.

    Args:
        timeout (int):
            How long (in seconds) to wait for the operation to complete.
            If None, wait indefinitely.
    """
    if self._result_set:
        return

    retry_ = self._retry.with_deadline(timeout)

    try:
        retry_(self._done_or_raise)()
    except exceptions.RetryError:
        raise concurrent.futures.TimeoutError(
          "Operation did not complete within the designated " "timeout."
        )

E concurrent.futures._base.TimeoutError: Operation did not complete within the designated timeout.

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:107: TimeoutError

Activity

  1. flaky-bot
    added
    buildcop: issue
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Jul 4, 2020
  2. blunderbuss-gcf
    assigned
    leahecole
    on Jul 4, 2020
  3. flaky-bot
    added
    buildcop: flaky
    on Jul 4, 2020
  4. flaky-bot commented on Jul 4, 2020

    @flaky-bot
    flaky-botBot
    on Jul 4, 2020
    Author
    More actions

    Looks like this issue is flaky. 😟

    I'm going to leave this open and stop commenting.

    A human should fix and close this.


    When run at the same commit (51a66f9), this test passed in one build (Build Status, Sponge) and failed in another build (Build Status, Sponge).

  5. tmatsuo
    assigned
    tmatsuo
    and unassigned
    leahecole
    on Jul 6, 2020
  6. tmatsuo
    added a commit that references this issue on Jul 6, 2020

    testing(translate): parameterize the timeout

    This issue will close once commit 36d0546 is merged into the 'master' branch.
    36d0546
  7. tmatsuo
    closed this as completedin #4247on Jul 6, 2020
  8. tmatsuo
    added a commit that references this issue on Jul 6, 2020

    testing(translate): parameterize the timeout (#4247)

    This issue will close once commit ddb0ddb is merged into the 'main' branch.
    ddb0ddb
  9. flaky-bot
    reopened this on Jul 12, 2020
  10. flaky-bot commented on Jul 12, 2020

    @flaky-bot
    flaky-botBot
    on Jul 12, 2020
    Author
    More actions

    Oops! Looks like this issue is still flaky. It failed again. 😬

    I reopened the issue, but a human will need to close it again.


    commit: 899251e
    buildURL: Build Status, Sponge
    status: failed

    Test output
    target = functools.partial(>)
    predicate = .if_exception_type_predicate at 0x7f305ed06598>
    sleep_generator = 
    deadline = 240, on_error = None
    
    def retry_target(target, predicate, sleep_generator, deadline, on_error=None):
        """Call a function and retry if it fails.
    
        This is the lowest-level retry helper. Generally, you'll use the
        higher-level retry helper :class:`Retry`.
    
        Args:
            target(Callable): The function to call and retry. This must be a
                nullary function - apply arguments with `functools.partial`.
            predicate (Callable[Exception]): A callable used to determine if an
                exception raised by the target should be considered retryable.
                It should return True to retry or False otherwise.
            sleep_generator (Iterable[float]): An infinite iterator that determines
                how long to sleep between retries.
            deadline (float): How long to keep retrying the target. The last sleep
                period is shortened as necessary, so that the last retry runs at
                ``deadline`` (and not considerably beyond it).
            on_error (Callable[Exception]): A function to call while processing a
                retryable exception.  Any error raised by this function will *not*
                be caught.
    
        Returns:
            Any: the return value of the target function.
    
        Raises:
            google.api_core.RetryError: If the deadline is exceeded while retrying.
            ValueError: If the sleep generator stops yielding values.
            Exception: If the target raises a method that isn't retryable.
        """
        if deadline is not None:
            deadline_datetime = datetime_helpers.utcnow() + datetime.timedelta(
                seconds=deadline
            )
        else:
            deadline_datetime = None
    
        last_exc = None
    
        for sleep in sleep_generator:
            try:
    
              return target()
    

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:184:


    self = <google.api_core.operation.Operation object at 0x7f305c3cb198>

    def _done_or_raise(self):
        """Check if the future is done and raise if it's not."""
        if not self.done():
    
          raise _OperationNotComplete()
    

    E google.api_core.future.polling._OperationNotComplete

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:84: _OperationNotComplete

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

    self = <google.api_core.operation.Operation object at 0x7f305c3cb198>
    timeout = 240

    def _blocking_poll(self, timeout=None):
        """Poll and wait for the Future to be resolved.
    
        Args:
            timeout (int):
                How long (in seconds) to wait for the operation to complete.
                If None, wait indefinitely.
        """
        if self._result_set:
            return
    
        retry_ = self._retry.with_deadline(timeout)
    
        try:
    
          retry_(self._done_or_raise)()
    

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:104:


    args = (), kwargs = {}
    target = functools.partial(<bound method PollingFuture._done_or_raise of <google.api_core.operation.Operation object at 0x7f305c3cb198>>)
    sleep_generator = <generator object exponential_sleep_generator at 0x7f305c3188e0>

    @general_helpers.wraps(func)
    def retry_wrapped_func(*args, **kwargs):
        """A wrapper that calls target function with retry."""
        target = functools.partial(func, *args, **kwargs)
        sleep_generator = exponential_sleep_generator(
            self._initial, self._maximum, multiplier=self._multiplier
        )
        return retry_target(
            target,
            self._predicate,
            sleep_generator,
            self._deadline,
    
          on_error=on_error,
    
        )
    

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:286:


    target = functools.partial(<bound method PollingFuture._done_or_raise of <google.api_core.operation.Operation object at 0x7f305c3cb198>>)
    predicate = <function if_exception_type..if_exception_type_predicate at 0x7f305ed06598>
    sleep_generator = <generator object exponential_sleep_generator at 0x7f305c3188e0>
    deadline = 240, on_error = None

    def retry_target(target, predicate, sleep_generator, deadline, on_error=None):
        """Call a function and retry if it fails.
    
        This is the lowest-level retry helper. Generally, you'll use the
        higher-level retry helper :class:`Retry`.
    
        Args:
            target(Callable): The function to call and retry. This must be a
                nullary function - apply arguments with `functools.partial`.
            predicate (Callable[Exception]): A callable used to determine if an
                exception raised by the target should be considered retryable.
                It should return True to retry or False otherwise.
            sleep_generator (Iterable[float]): An infinite iterator that determines
                how long to sleep between retries.
            deadline (float): How long to keep retrying the target. The last sleep
                period is shortened as necessary, so that the last retry runs at
                ``deadline`` (and not considerably beyond it).
            on_error (Callable[Exception]): A function to call while processing a
                retryable exception.  Any error raised by this function will *not*
                be caught.
    
        Returns:
            Any: the return value of the target function.
    
        Raises:
            google.api_core.RetryError: If the deadline is exceeded while retrying.
            ValueError: If the sleep generator stops yielding values.
            Exception: If the target raises a method that isn't retryable.
        """
        if deadline is not None:
            deadline_datetime = datetime_helpers.utcnow() + datetime.timedelta(
                seconds=deadline
            )
        else:
            deadline_datetime = None
    
        last_exc = None
    
        for sleep in sleep_generator:
            try:
                return target()
    
            # pylint: disable=broad-except
            # This function explicitly must deal with broad exceptions.
            except Exception as exc:
                if not predicate(exc):
                    raise
                last_exc = exc
                if on_error is not None:
                    on_error(exc)
    
            now = datetime_helpers.utcnow()
    
            if deadline_datetime is not None:
                if deadline_datetime <= now:
                    six.raise_from(
                        exceptions.RetryError(
                            "Deadline of {:.1f}s exceeded while calling {}".format(
                                deadline, target
                            ),
                            last_exc,
                        ),
    
                      last_exc,
    
                    )
    

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:206:


    value = None, from_value = _OperationNotComplete()

    ???
    E google.api_core.exceptions.RetryError: Deadline of 240.0s exceeded while calling functools.partial(<bound method PollingFuture._done_or_raise of <google.api_core.operation.Operation object at 0x7f305c3cb198>>), last exception:

    :3: RetryError

    During handling of the above exception, another exception occurred:

    capsys = <_pytest.capture.CaptureFixture object at 0x7f305c34d358>
    bucket = <Bucket: tmp-02a8da71ec504d0da6d7b03a19d90c4e>
    glossary = 'test-109d706e-9871-44d4-b9ff-b7625fe42fa4'

    @pytest.mark.flaky(max_runs=3, min_passes=1)
    def test_batch_translate_text_with_glossary(capsys, bucket, glossary):
        translate_v3_batch_translate_text_with_glossary.batch_translate_text_with_glossary(
            "gs://cloud-samples-data/translation/text_with_glossary.txt",
            "gs://{}/translation/BATCH_TRANSLATION_OUTPUT/".format(bucket.name),
            PROJECT_ID,
            glossary,
    
          240
    
        )
    

    translate_v3_batch_translate_text_with_glossary_test.py:76:


    translate_v3_batch_translate_text_with_glossary.py:69: in batch_translate_text_with_glossary
    response = operation.result(timeout)
    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:125: in result
    self._blocking_poll(timeout=timeout)


    self = <google.api_core.operation.Operation object at 0x7f305c3cb198>
    timeout = 240

    def _blocking_poll(self, timeout=None):
        """Poll and wait for the Future to be resolved.
    
        Args:
            timeout (int):
                How long (in seconds) to wait for the operation to complete.
                If None, wait indefinitely.
        """
        if self._result_set:
            return
    
        retry_ = self._retry.with_deadline(timeout)
    
        try:
            retry_(self._done_or_raise)()
        except exceptions.RetryError:
            raise concurrent.futures.TimeoutError(
    
              "Operation did not complete within the designated " "timeout."
    
            )
    

    E concurrent.futures._base.TimeoutError: Operation did not complete within the designated timeout.

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:107: TimeoutError

  11. yoshi-automation
    added
    🚨This issue needs some love.
    on Jul 12, 2020
  12. tmatsuo commented on Jul 13, 2020

    @tmatsuo
    tmatsuo
    on Jul 13, 2020
    Contributor
    More actions

    There's not much we can do in the code IMO. Downgrading to p2.

  13. tmatsuo
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    and removed
    🚨This issue needs some love.
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    on Jul 13, 2020
  14. tmatsuo commented on Jul 16, 2020

    @tmatsuo
    tmatsuo
    on Jul 16, 2020
    Contributor
    More actions

    I'm fine with a little bit of flakiness as long as it's not happening too often.

  15. tmatsuo
    closed this as completedon Jul 16, 2020
  16. flaky-bot
    reopened this on Jul 20, 2020
  17. flaky-bot commented on Jul 20, 2020

    @flaky-bot
    flaky-botBot
    on Jul 20, 2020
    Author
    More actions

    Oops! Looks like this issue is still flaky. It failed again. 😬

    I reopened the issue, but a human will need to close it again.


    commit: 3e55269
    buildURL: Build Status, Sponge
    status: failed

    Test output
    target = functools.partial(>)
    predicate = .if_exception_type_predicate at 0x7f06a8159158>
    sleep_generator = 
    deadline = 240, on_error = None
    
    def retry_target(target, predicate, sleep_generator, deadline, on_error=None):
        """Call a function and retry if it fails.
    
        This is the lowest-level retry helper. Generally, you'll use the
        higher-level retry helper :class:`Retry`.
    
        Args:
            target(Callable): The function to call and retry. This must be a
                nullary function - apply arguments with `functools.partial`.
            predicate (Callable[Exception]): A callable used to determine if an
                exception raised by the target should be considered retryable.
                It should return True to retry or False otherwise.
            sleep_generator (Iterable[float]): An infinite iterator that determines
                how long to sleep between retries.
            deadline (float): How long to keep retrying the target. The last sleep
                period is shortened as necessary, so that the last retry runs at
                ``deadline`` (and not considerably beyond it).
            on_error (Callable[Exception]): A function to call while processing a
                retryable exception.  Any error raised by this function will *not*
                be caught.
    
        Returns:
            Any: the return value of the target function.
    
        Raises:
            google.api_core.RetryError: If the deadline is exceeded while retrying.
            ValueError: If the sleep generator stops yielding values.
            Exception: If the target raises a method that isn't retryable.
        """
        if deadline is not None:
            deadline_datetime = datetime_helpers.utcnow() + datetime.timedelta(
                seconds=deadline
            )
        else:
            deadline_datetime = None
    
        last_exc = None
    
        for sleep in sleep_generator:
            try:
    
              return target()
    

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:184:


    self = <google.api_core.operation.Operation object at 0x7f06a4fc0940>

    def _done_or_raise(self):
        """Check if the future is done and raise if it's not."""
        if not self.done():
    
          raise _OperationNotComplete()
    

    E google.api_core.future.polling._OperationNotComplete

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:84: _OperationNotComplete

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

    self = <google.api_core.operation.Operation object at 0x7f06a4fc0940>
    timeout = 240

    def _blocking_poll(self, timeout=None):
        """Poll and wait for the Future to be resolved.
    
        Args:
            timeout (int):
                How long (in seconds) to wait for the operation to complete.
                If None, wait indefinitely.
        """
        if self._result_set:
            return
    
        retry_ = self._retry.with_deadline(timeout)
    
        try:
    
          retry_(self._done_or_raise)()
    

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:104:


    args = (), kwargs = {}
    target = functools.partial(<bound method PollingFuture._done_or_raise of <google.api_core.operation.Operation object at 0x7f06a4fc0940>>)
    sleep_generator = <generator object exponential_sleep_generator at 0x7f06a4ff0200>

    @general_helpers.wraps(func)
    def retry_wrapped_func(*args, **kwargs):
        """A wrapper that calls target function with retry."""
        target = functools.partial(func, *args, **kwargs)
        sleep_generator = exponential_sleep_generator(
            self._initial, self._maximum, multiplier=self._multiplier
        )
        return retry_target(
            target,
            self._predicate,
            sleep_generator,
            self._deadline,
    
          on_error=on_error,
    
        )
    

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:286:


    target = functools.partial(<bound method PollingFuture._done_or_raise of <google.api_core.operation.Operation object at 0x7f06a4fc0940>>)
    predicate = <function if_exception_type..if_exception_type_predicate at 0x7f06a8159158>
    sleep_generator = <generator object exponential_sleep_generator at 0x7f06a4ff0200>
    deadline = 240, on_error = None

    def retry_target(target, predicate, sleep_generator, deadline, on_error=None):
        """Call a function and retry if it fails.
    
        This is the lowest-level retry helper. Generally, you'll use the
        higher-level retry helper :class:`Retry`.
    
        Args:
            target(Callable): The function to call and retry. This must be a
                nullary function - apply arguments with `functools.partial`.
            predicate (Callable[Exception]): A callable used to determine if an
                exception raised by the target should be considered retryable.
                It should return True to retry or False otherwise.
            sleep_generator (Iterable[float]): An infinite iterator that determines
                how long to sleep between retries.
            deadline (float): How long to keep retrying the target. The last sleep
                period is shortened as necessary, so that the last retry runs at
                ``deadline`` (and not considerably beyond it).
            on_error (Callable[Exception]): A function to call while processing a
                retryable exception.  Any error raised by this function will *not*
                be caught.
    
        Returns:
            Any: the return value of the target function.
    
        Raises:
            google.api_core.RetryError: If the deadline is exceeded while retrying.
            ValueError: If the sleep generator stops yielding values.
            Exception: If the target raises a method that isn't retryable.
        """
        if deadline is not None:
            deadline_datetime = datetime_helpers.utcnow() + datetime.timedelta(
                seconds=deadline
            )
        else:
            deadline_datetime = None
    
        last_exc = None
    
        for sleep in sleep_generator:
            try:
                return target()
    
            # pylint: disable=broad-except
            # This function explicitly must deal with broad exceptions.
            except Exception as exc:
                if not predicate(exc):
                    raise
                last_exc = exc
                if on_error is not None:
                    on_error(exc)
    
            now = datetime_helpers.utcnow()
    
            if deadline_datetime is not None:
                if deadline_datetime <= now:
                    six.raise_from(
                        exceptions.RetryError(
                            "Deadline of {:.1f}s exceeded while calling {}".format(
                                deadline, target
                            ),
                            last_exc,
                        ),
    
                      last_exc,
    
                    )
    

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/retry.py:206:


    value = None, from_value = _OperationNotComplete()

    ???
    E google.api_core.exceptions.RetryError: Deadline of 240.0s exceeded while calling functools.partial(<bound method PollingFuture._done_or_raise of <google.api_core.operation.Operation object at 0x7f06a4fc0940>>), last exception:

    :3: RetryError

    During handling of the above exception, another exception occurred:

    capsys = <_pytest.capture.CaptureFixture object at 0x7f06a7f980b8>
    bucket = <Bucket: tmp-a20fcb41c45c48339c9a1d5a07ff438d>
    glossary = 'test-a9729035-dc3a-4db4-8cb8-3816437ce891'

    @pytest.mark.flaky(max_runs=3, min_passes=1)
    def test_batch_translate_text_with_glossary(capsys, bucket, glossary):
        translate_v3_batch_translate_text_with_glossary.batch_translate_text_with_glossary(
            "gs://cloud-samples-data/translation/text_with_glossary.txt",
            "gs://{}/translation/BATCH_TRANSLATION_OUTPUT/".format(bucket.name),
            PROJECT_ID,
            glossary,
    
          240
    
        )
    

    translate_v3_batch_translate_text_with_glossary_test.py:76:


    translate_v3_batch_translate_text_with_glossary.py:69: in batch_translate_text_with_glossary
    response = operation.result(timeout)
    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:125: in result
    self._blocking_poll(timeout=timeout)


    self = <google.api_core.operation.Operation object at 0x7f06a4fc0940>
    timeout = 240

    def _blocking_poll(self, timeout=None):
        """Poll and wait for the Future to be resolved.
    
        Args:
            timeout (int):
                How long (in seconds) to wait for the operation to complete.
                If None, wait indefinitely.
        """
        if self._result_set:
            return
    
        retry_ = self._retry.with_deadline(timeout)
    
        try:
            retry_(self._done_or_raise)()
        except exceptions.RetryError:
            raise concurrent.futures.TimeoutError(
    
              "Operation did not complete within the designated " "timeout."
    
            )
    

    E concurrent.futures._base.TimeoutError: Operation did not complete within the designated timeout.

    .nox/py-3-6/lib/python3.6/site-packages/google/api_core/future/polling.py:107: TimeoutError

  18. tmatsuo
    assigned
    telpirion
    on Jul 21, 2020
  19. tmatsuo
    closed this as completedin #4357on Jul 22, 2020
  20. telpirion
    added 2 commits that reference this issue on Nov 16, 2022

    testing(translate): parameterize the timeout [(#4247)](#4247)

    This issue will close once commit c2cb9f6 is merged into the 'main' branch.
    c2cb9f6

    feat!: migrate API to microgenerator (#31)

    This issue will close once commit 42b85b3 is merged into the 'main' branch.
    42b85b3
  21. dandhlee
    added 2 commits that reference this issue on Nov 18, 2022

    testing(translate): parameterize the timeout [(#4247)](#4247)

    This issue will close once commit eeb7b25 is merged into the 'main' branch.
    eeb7b25

    feat!: migrate API to microgenerator (#31)

    This issue will close once commit 3719204 is merged into the 'main' branch.
    3719204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @telpirion
    telpirion
  • @tmatsuo
    tmatsuo

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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.