googleapis/python-automl

samples.beta.video_object_tracking_create_model_test: test_video_classification_create_model failed

flaky-bot opened this issue · 1 comments

This test failed!

To configure my behavior, see the Flaky Bot documentation.

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


commit: 788a1b3
buildURL: Build Status, Sponge
status: failed

Test output
args = (parent: "projects/python-docs-samples-tests/locations/us-central1"
model {
  display_name: "video_object_test_create_model"
  dataset_id: "VOT00000000000000000000"
  video_object_tracking_model_metadata {
  }
}
,)
kwargs = {'metadata': [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.7.10 grpc/1.38.1 gax/1.31.0 gapic/2.4.0')]}
@six.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:67:


self = <grpc._channel._UnaryUnaryMultiCallable object at 0x7ff3916b2f10>
request = parent: "projects/python-docs-samples-tests/locations/us-central1"
model {
display_name: "video_object_test_create_model"
dataset_id: "VOT00000000000000000000"
video_object_tracking_model_metadata {
}
}

timeout = None
metadata = [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.7.10 grpc/1.38.1 gax/1.31.0 gapic/2.4.0')]
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 0x7ff393b28810>
call = <grpc._cython.cygrpc.SegregatedCall object at 0x7ff393aa6280>
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.UNAUTHENTICATED
E details = "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
E debug_error_string = "{"created":"@1626170566.303268897","description":"Error received from peer ipv4:74.125.195.95:443","file":"src/core/lib/surface/call.cc","file_line":1066,"grpc_message":"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"
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 0x7ff393bfbb90>

def test_video_classification_create_model(capsys):
    try:
        video_object_tracking_create_model.create_model(
          PROJECT_ID, DATASET_ID, "video_object_test_create_model"
        )

video_object_tracking_create_model_test.py:27:


project_id = 'python-docs-samples-tests', dataset_id = 'VOT00000000000000000000'
display_name = 'video_object_test_create_model'

def create_model(
    project_id="YOUR_PROJECT_ID",
    dataset_id="YOUR_DATASET_ID",
    display_name="your_models_display_name",
):
    """Create a automl video classification model."""
    client = automl.AutoMlClient()

    # A resource that represents Google Cloud Platform loacation.
    project_location = f"projects/{project_id}/locations/us-central1"
    # Leave model unset to use the default base model provided by Google
    metadata = automl.VideoObjectTrackingModelMetadata()
    model = automl.Model(
        display_name=display_name,
        dataset_id=dataset_id,
        video_object_tracking_model_metadata=metadata,
    )

    # Create a model with the model metadata in the region.
  response = client.create_model(parent=project_location, model=model)

video_object_tracking_create_model.py:38:


self = <google.cloud.automl_v1beta1.services.auto_ml.client.AutoMlClient object at 0x7ff391a1ca50>
request = parent: "projects/python-docs-samples-tests/locations/us-central1"
model {
display_name: "video_object_test_create_model"
dataset_id: "VOT00000000000000000000"
video_object_tracking_model_metadata {
}
}

def create_model(
    self,
    request: service.CreateModelRequest = None,
    *,
    parent: str = None,
    model: gca_model.Model = None,
    retry: retries.Retry = gapic_v1.method.DEFAULT,
    timeout: float = None,
    metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
    r"""Creates a model. Returns a Model in the
    [response][google.longrunning.Operation.response] field when it
    completes. When you create a model, several model evaluations
    are created for it: a global evaluation, and one evaluation for
    each annotation spec.

    Args:
        request (google.cloud.automl_v1beta1.types.CreateModelRequest):
            The request object. Request message for
            [AutoMl.CreateModel][google.cloud.automl.v1beta1.AutoMl.CreateModel].
        parent (str):
            Required. Resource name of the parent
            project where the model is being
            created.

            This corresponds to the ``parent`` field
            on the ``request`` instance; if ``request`` is provided, this
            should not be set.
        model (google.cloud.automl_v1beta1.types.Model):
            Required. The model to create.
            This corresponds to the ``model`` field
            on the ``request`` instance; if ``request`` is provided, this
            should not be set.
        retry (google.api_core.retry.Retry): Designation of what errors, if any,
            should be retried.
        timeout (float): The timeout for this request.
        metadata (Sequence[Tuple[str, str]]): Strings which should be
            sent along with the request as metadata.

    Returns:
        google.api_core.operation.Operation:
            An object representing a long-running operation.

            The result type for the operation will be
            :class:`google.cloud.automl_v1beta1.types.Model` API
            proto representing a trained machine learning model.

    """
    # Create or coerce a protobuf request object.
    # Sanity check: If we got a request object, we should *not* have
    # gotten any keyword arguments that map to the request.
    has_flattened_params = any([parent, model])
    if request is not None and has_flattened_params:
        raise ValueError(
            "If the `request` argument is set, then none of "
            "the individual field arguments should be set."
        )

    # Minor optimization to avoid making a copy if the user passes
    # in a service.CreateModelRequest.
    # There's no risk of modifying the input as we've already verified
    # there are no flattened fields.
    if not isinstance(request, service.CreateModelRequest):
        request = service.CreateModelRequest(request)
        # If we have keyword arguments corresponding to fields on the
        # request, apply these.
        if parent is not None:
            request.parent = parent
        if model is not None:
            request.model = model

    # Wrap the RPC method; this adds retry and timeout information,
    # and friendly error handling.
    rpc = self._transport._wrapped_methods[self._transport.create_model]

    # Certain fields should be provided within the metadata header;
    # add these here.
    metadata = tuple(metadata) + (
        gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
    )

    # Send the request.
  response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)

../../google/cloud/automl_v1beta1/services/auto_ml/client.py:1726:


self = <google.api_core.gapic_v1.method.GapicCallable object at 0x7ff3916b2d90>
args = (parent: "projects/python-docs-samples-tests/locations/us-central1"
model {
display_name: "video_object_test_create_model"
dataset_id: "VOT00000000000000000000"
video_object_tracking_model_metadata {
}
}
,)
kwargs = {'metadata': [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.7.10 grpc/1.38.1 gax/1.31.0 gapic/2.4.0')]}
timeout
= None, retry = None
wrapped_func = <function _wrap_unary_errors..error_remapped_callable at 0x7ff393bfc8c0>
metadata = [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.7.10 grpc/1.38.1 gax/1.31.0 gapic/2.4.0')]

def __call__(self, *args, **kwargs):
    """Invoke the low-level RPC with retry, timeout, and metadata."""
    # Note: Due to Python 2 lacking keyword-only arguments we use kwargs to
    # extract the retry and timeout params.
    timeout_ = _determine_timeout(
        self._timeout,
        kwargs.pop("timeout", self._timeout),
        # Use only the invocation-specified retry only for this, as we only
        # want to adjust the timeout deadline if the *user* specified
        # a different retry.
        kwargs.get("retry", None),
    )

    retry = kwargs.pop("retry", self._retry)

    if retry is DEFAULT:
        retry = self._retry

    # Apply all applicable decorators.
    wrapped_func = _apply_decorators(self._target, [retry, timeout_])

    # Add the user agent metadata to the call.
    if self._metadata is not None:
        metadata = kwargs.get("metadata", [])
        # Due to the nature of invocation, None should be treated the same
        # as not specified.
        if metadata is None:
            metadata = []
        metadata = list(metadata)
        metadata.extend(self._metadata)
        kwargs["metadata"] = metadata
  return wrapped_func(*args, **kwargs)

.nox/py-3-7/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py:145:


args = (parent: "projects/python-docs-samples-tests/locations/us-central1"
model {
display_name: "video_object_test_create_model"
dataset_id: "VOT00000000000000000000"
video_object_tracking_model_metadata {
}
}
,)
kwargs = {'metadata': [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/us-central1'), ('x-goog-api-client', 'gl-python/3.7.10 grpc/1.38.1 gax/1.31.0 gapic/2.4.0')]}

@six.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
    try:
        return callable_(*args, **kwargs)
    except grpc.RpcError as exc:
      six.raise_from(exceptions.from_grpc_error(exc), exc)

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


value = None
from_value = <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAUTHENTICATED
details = "Request had invalid a...entication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"

???
E google.api_core.exceptions.Unauthenticated: 401 Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

:3: Unauthenticated

During handling of the above exception, another exception occurred:

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

def test_video_classification_create_model(capsys):
    try:
        video_object_tracking_create_model.create_model(
            PROJECT_ID, DATASET_ID, "video_object_test_create_model"
        )
        out, _ = capsys.readouterr()
        assert "Dataset does not exist." in out
    except Exception as e:
      assert "Dataset does not exist." in e.message

E AssertionError: assert 'Dataset does not exist.' in 'Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.'
E + where 'Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.' = Unauthenticated('Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.').message

video_object_tracking_create_model_test.py:32: AssertionError

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 (788a1b3), this test passed in one build (Build Status, Sponge) and failed in another build (Build Status, Sponge).