Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Operation Sample Tests are failing with 404 #387

Closed
parthea opened this issue Oct 4, 2022 · 2 comments · Fixed by #393
Closed

Operation Sample Tests are failing with 404 #387

parthea opened this issue Oct 4, 2022 · 2 comments · Fixed by #393
Assignees
Labels
api: documentai Issues related to the googleapis/python-documentai API. samples Issues that are directly related to samples. type: docs Improvement to the documentation for an API.

Comments

@parthea
Copy link
Contributor

parthea commented Oct 4, 2022

Several sample tests are failing with 404. See build log here and stack trace below.

batch_process_documents_processor_version_sample_test.py .               [  3%]
batch_process_documents_sample_bad_input_test.py .                       [  6%]
batch_process_documents_sample_test.py .                                 [ 10%]
**cancel_operation_sample_test.py F**                                        [ 13%]
create_processor_sample_test.py .                                        [ 17%]
delete_processor_sample_test.py .                                        [ 20%]
delete_processor_version_sample_test.py .                                [ 24%]
deploy_processor_version_sample_test.py .                                [ 27%]
disable_processor_sample_test.py .                                       [ 31%]
enable_processor_sample_test.py .                                        [ 34%]
fetch_processor_types_sample_test.py .                                   [ 37%]
**get_operation_sample_test.py F**                                           [ 41%]
get_processor_sample_test.py .                                           [ 44%]
get_processor_version_sample_test.py .                                   [ 48%]
list_operations_sample_test.py .                                         [ 51%]
list_processor_versions_sample_test.py .                                 [ 55%]
list_processors_sample_test.py .                                         [ 58%]
**poll_operation_sample_test.py F**                                          [ 62%]
process_document_form_sample_test.py .                                   [ 65%]
process_document_ocr_sample_test.py .                                    [ 68%]
process_document_processor_version_sample_test.py .                      [ 72%]
process_document_quality_sample_test.py .                                [ 75%]
process_document_sample_test.py .                                        [ 79%]
process_document_specialized_sample_test.py .                            [ 82%]
process_document_splitter_sample_test.py .                               [ 86%]
quickstart_sample_test.py .                                              [ 89%]
review_document_sample_test.py .                                         [ 93%]
set_default_processor_version_sample_test.py .                           [ 96%]
undeploy_processor_version_sample_test.py .                              [100%]
____________________________ test_cancel_operation _____________________________

capsys = <_pytest.capture.CaptureFixture object at 0x7f7360b46e50>

    def test_cancel_operation(capsys):
        cancel_operation_sample.cancel_operation_sample(
            location=location, operation_name=operation_name
        )
        out, _ = capsys.readouterr()

        assert "Operation" in out
>       assert "cancelled" in out
E       assert 'cancelled' in "Operation not found: '4311241022337572151'.\n"

cancel_operation_sample_test.py:33: AssertionError
______________________________ test_get_operation ______________________________

args = (name: "projects/python-docs-samples-tests/locations/us/operations/10828996427112056798"
,)
kwargs = {'metadata': [('x-goog-request-params', 'name=projects/python-docs-samples-tests/locations/us/operations/10828996427112056798'), ('x-goog-api-client', 'gl-python/3.7.12 grpc/1.49.1 gax/2.10.1 gapic/2.0.2')]}

    @functools.wraps(callable_)
    def error_remapped_callable(*args, **kwargs):
        try:
>           return callable_(*args, **kwargs)

.nox/py-3-7/lib/python3.7/site-packages/google/api_core/grpc_helpers.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <grpc._channel._UnaryUnaryMultiCallable object at 0x7f7360ae9250>
request = name: "projects/python-docs-samples-tests/locations/us/operations/10828996427112056798"

timeout = None
metadata = [('x-goog-request-params', 'name=projects/python-docs-samples-tests/locations/us/operations/10828996427112056798'), ('x-goog-api-client', 'gl-python/3.7.12 grpc/1.49.1 gax/2.10.1 gapic/2.0.2')]
credentials = None, wait_for_ready = None, compression = None

    def __call__(self,
                 request,
                 timeout=None,
                 metadata=None,
                 credentials=None,
                 wait_for_ready=None,
                 compression=None):
        state, call, = self._blocking(request, timeout, metadata, credentials,
                                      wait_for_ready, compression)
>       return _end_unary_response_blocking(state, call, False, None)

.nox/py-3-7/lib/python3.7/site-packages/grpc/_channel.py:946:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

state = <grpc._channel._RPCState object at 0x7f7360ae9a90>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f7360b125f0>
with_call = False, deadline = None

    def _end_unary_response_blocking(state, call, with_call, deadline):
        if state.code is grpc.StatusCode.OK:
            if with_call:
                rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
                return state.response, rendezvous
            else:
                return state.response
        else:
>           raise _InactiveRpcError(state)
E           grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E           	status = StatusCode.NOT_FOUND
E           	details = "Operation not found: 'projects/python-docs-samples-tests/locations/us/operations/10828996427112056798'."
E           	debug_error_string = "UNKNOWN:Error received from peer ipv4:74.125.197.95:443 {grpc_message:"Operation not found: \'projects/python-docs-samples-tests/locations/us/operations/10828996427112056798\'.", grpc_status:5, created_time:"2022-10-04T02:44:01.145027628+00:00"}"
E           >

.nox/py-3-7/lib/python3.7/site-packages/grpc/_channel.py:849: _InactiveRpcError

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

capsys = <_pytest.capture.CaptureFixture object at 0x7f7360b0bf90>

    def test_get_operation(capsys):
        get_operation_sample.get_operation_sample(
>           location=location, operation_name=operation_name
        )

get_operation_sample_test.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
get_operation_sample.py:36: in get_operation_sample
    operation = client.get_operation(request=request)
../../google/cloud/documentai_v1/services/document_processor_service/client.py:2600: in get_operation
    metadata=metadata,
.nox/py-3-7/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py:154: in __call__
    return wrapped_func(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = (name: "projects/python-docs-samples-tests/locations/us/operations/10828996427112056798"
,)
kwargs = {'metadata': [('x-goog-request-params', 'name=projects/python-docs-samples-tests/locations/us/operations/10828996427112056798'), ('x-goog-api-client', 'gl-python/3.7.12 grpc/1.49.1 gax/2.10.1 gapic/2.0.2')]}

    @functools.wraps(callable_)
    def error_remapped_callable(*args, **kwargs):
        try:
            return callable_(*args, **kwargs)
        except grpc.RpcError as exc:
>           raise exceptions.from_grpc_error(exc) from exc
E           google.api_core.exceptions.NotFound: 404 Operation not found: 'projects/python-docs-samples-tests/locations/us/operations/10828996427112056798'.

.nox/py-3-7/lib/python3.7/site-packages/google/api_core/grpc_helpers.py:74: NotFound
_____________________________ test_poll_operation ______________________________

args = (name: "projects/python-docs-samples-tests/locations/us/operations/10828996427112056798"
,)
kwargs = {'metadata': [('x-goog-request-params', 'name=projects/python-docs-samples-tests/locations/us/operations/10828996427112056798'), ('x-goog-api-client', 'gl-python/3.7.12 grpc/1.49.1 gax/2.10.1 gapic/2.0.2')]}

    @functools.wraps(callable_)
    def error_remapped_callable(*args, **kwargs):
        try:
>           return callable_(*args, **kwargs)

.nox/py-3-7/lib/python3.7/site-packages/google/api_core/grpc_helpers.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <grpc._channel._UnaryUnaryMultiCallable object at 0x7f73613e1610>
request = name: "projects/python-docs-samples-tests/locations/us/operations/10828996427112056798"

timeout = None
metadata = [('x-goog-request-params', 'name=projects/python-docs-samples-tests/locations/us/operations/10828996427112056798'), ('x-goog-api-client', 'gl-python/3.7.12 grpc/1.49.1 gax/2.10.1 gapic/2.0.2')]
credentials = None, wait_for_ready = None, compression = None

    def __call__(self,
                 request,
                 timeout=None,
                 metadata=None,
                 credentials=None,
                 wait_for_ready=None,
                 compression=None):
        state, call, = self._blocking(request, timeout, metadata, credentials,
                                      wait_for_ready, compression)
>       return _end_unary_response_blocking(state, call, False, None)

.nox/py-3-7/lib/python3.7/site-packages/grpc/_channel.py:946:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

state = <grpc._channel._RPCState object at 0x7f73613e1650>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f736352a0a0>
with_call = False, deadline = None

    def _end_unary_response_blocking(state, call, with_call, deadline):
        if state.code is grpc.StatusCode.OK:
            if with_call:
                rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
                return state.response, rendezvous
            else:
                return state.response
        else:
>           raise _InactiveRpcError(state)
E           grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E           	status = StatusCode.NOT_FOUND
E           	details = "Operation not found: 'projects/python-docs-samples-tests/locations/us/operations/10828996427112056798'."
E           	debug_error_string = "UNKNOWN:Error received from peer ipv4:74.125.197.95:443 {grpc_message:"Operation not found: \'projects/python-docs-samples-tests/locations/us/operations/10828996427112056798\'.", grpc_status:5, created_time:"2022-10-04T02:44:07.45772333+00:00"}"
E           >

.nox/py-3-7/lib/python3.7/site-packages/grpc/_channel.py:849: _InactiveRpcError

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

capsys = <_pytest.capture.CaptureFixture object at 0x7f73613588d0>

    def test_poll_operation(capsys):
        poll_operation_sample.poll_operation_sample(
>           location=location, operation_name=operation_name
        )

poll_operation_sample_test.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
poll_operation_sample.py:39: in poll_operation_sample
    operation = client.get_operation(request=request)
../../google/cloud/documentai_v1/services/document_processor_service/client.py:2600: in get_operation
    metadata=metadata,
.nox/py-3-7/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py:154: in __call__
    return wrapped_func(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = (name: "projects/python-docs-samples-tests/locations/us/operations/10828996427112056798"
,)
kwargs = {'metadata': [('x-goog-request-params', 'name=projects/python-docs-samples-tests/locations/us/operations/10828996427112056798'), ('x-goog-api-client', 'gl-python/3.7.12 grpc/1.49.1 gax/2.10.1 gapic/2.0.2')]}

    @functools.wraps(callable_)
    def error_remapped_callable(*args, **kwargs):
        try:
            return callable_(*args, **kwargs)
        except grpc.RpcError as exc:
>           raise exceptions.from_grpc_error(exc) from exc
E           google.api_core.exceptions.NotFound: 404 Operation not found: 'projects/python-docs-samples-tests/locations/us/operations/10828996427112056798'.

.nox/py-3-7/lib/python3.7/site-packages/google/api_core/grpc_helpers.py:74: NotFound
@product-auto-label product-auto-label bot added the api: documentai Issues related to the googleapis/python-documentai API. label Oct 4, 2022
@parthea parthea added samples Issues that are directly related to samples. type: docs Improvement to the documentation for an API. and removed api: documentai Issues related to the googleapis/python-documentai API. labels Oct 4, 2022
@parthea
Copy link
Contributor Author

parthea commented Oct 4, 2022

@holtskinner Please could you take a look?

@holtskinner
Copy link
Member

I believe these are failing because the operation IDs expire after a certain amount of time.

Might need to mock the input/output for these operation functions in tests to avoid these issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: documentai Issues related to the googleapis/python-documentai API. samples Issues that are directly related to samples. type: docs Improvement to the documentation for an API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy