This repository was archived by the owner on Aug 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 25, 2026. It is now read-only.
NameError: name 'operation' is not defined #610
Copy link
Copy link
Closed
Labels
priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important 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.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
I'm seeing generated test fails on 0.33.4 for a new library google/cloud/aiplatform
The problem seems to be that google.api_core.operation is imported as ga_operation but the client references it as operation later on.
The API appears to have it's own operation type (from google.cloud.aiplatform_v1beta1.types import operation as gca_operation) which may be causing the conflict.
from collections import OrderedDict
from distutils import util
import os
import re
from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union
import pkg_resources
from google.api_core import client_options as client_options_lib # type: ignore
from google.api_core import exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials # type: ignore
from google.auth.transport import mtls # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore
from google.api_core import operation as ga_operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.aiplatform_v1beta1.services.specialist_pool_service import pagers
from google.cloud.aiplatform_v1beta1.types import operation as gca_operation
from google.cloud.aiplatform_v1beta1.types import specialist_pool
from google.cloud.aiplatform_v1beta1.types import specialist_pool as gca_specialist_pool
from google.cloud.aiplatform_v1beta1.types import specialist_pool_service
from google.protobuf import empty_pb2 as empty # type: ignore
from google.protobuf import field_mask_pb2 as field_mask # type: ignore
from .transports.base import SpecialistPoolServiceTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import SpecialistPoolServiceGrpcTransport
from .transports.grpc_asyncio import SpecialistPoolServiceGrpcAsyncIOTransport # Wrap the response in an operation future.
> response = operation.from_gapic(
response,
self._transport.operations_client,
gca_specialist_pool.SpecialistPool,
metadata_type=specialist_pool_service.UpdateSpecialistPoolOperationMetadata,
)
E NameError: name 'operation' is not defined
google/cloud/aiplatform_v1beta1/services/specialist_pool_service/client.py:745: NameErrorMetadata
Metadata
Assignees
Labels
priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important 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.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Activity
danoscarmike commentedon Sep 22, 2020
Bumping priority due to impact to product launch
hkdevandla commentedon Sep 22, 2020
Dov, can you please take a look? Thanks!
software-dov commentedon Sep 22, 2020
On it.
busunkim96 commentedon Sep 22, 2020
👋 I had a chat with @dizcology and AI Platform will likely have to use an older version of this generator for the time being b/c of other concerns. It it is alright to drop the priority on this since they already have a synth replace fix they wrote for the alpha.
software-dov commentedon Sep 22, 2020
I've got a fix I'm just about to post review, but it looks like there are other unit tests that are failing too.
fix: operation module is properly aliased if necessary
fix: operation module is properly aliased if necessary (#615)
software-dov commentedon Sep 22, 2020
Fixed by #615