@pytest.mark.asyncio
async def test_batch_migrate_resources_flattened_async():
client = MigrationServiceAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.batch_migrate_resources), "__call__"
) as call:
# Designate an appropriate return value for the call.
call.return_value = operations_pb2.Operation(name="operations/op")
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
operations_pb2.Operation(name="operations/spam")
)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
> response = await client.batch_migrate_resources(
parent="parent_value",
migrate_resource_requests=[
migration_service.MigrateResourceRequest(
migrate_ml_engine_model_version_config=migration_service.MigrateResourceRequest.MigrateMlEngineModelVersionConfig(
endpoint="endpoint_value"
)
)
],
)
tests/unit/gapic/aiplatform_v1/test_migration_service.py:1307:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
request = parent: "parent_value"
async def batch_migrate_resources(
self,
request: Union[migration_service.BatchMigrateResourcesRequest, dict] = None,
*,
parent: str = None,
migrate_resource_requests: Sequence[
migration_service.MigrateResourceRequest
] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Batch migrates resources from ml.googleapis.com,
automl.googleapis.com, and datalabeling.googleapis.com
to Vertex AI.
Args:
request (Union[google.cloud.aiplatform_v1.types.BatchMigrateResourcesRequest, dict]):
The request object. Request message for
[MigrationService.BatchMigrateResources][google.cloud.aiplatform.v1.MigrationService.BatchMigrateResources].
parent (:class:`str`):
Required. The location of the migrated resource will
live in. Format:
``projects/{project}/locations/{location}``
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
migrate_resource_requests (:class:`Sequence[google.cloud.aiplatform_v1.types.MigrateResourceRequest]`):
Required. The request messages
specifying the resources to migrate.
They must be in the same location as the
destination. Up to 50 resources can be
migrated in one batch.
This corresponds to the ``migrate_resource_requests`` 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_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be
:class:`google.cloud.aiplatform_v1.types.BatchMigrateResourcesResponse`
Response message for
[MigrationService.BatchMigrateResources][google.cloud.aiplatform.v1.MigrationService.BatchMigrateResources].
"""
# Create or coerce a protobuf request object.
# Quick 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, migrate_resource_requests])
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."
)
request = migration_service.BatchMigrateResourcesRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if migrate_resource_requests:
> request.migrate_resource_requests.extend(migrate_resource_requests)
E TypeError: Expected a message object, but got migrate_ml_engine_model_version_config {
E endpoint: "endpoint_value"
E }
E .
google/cloud/aiplatform_v1/services/migration_service/async_client.py:389: TypeError
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: 843461c92dd8aed5a3574c431a3fcd38beff0d96 buildURL: Build Status, Sponge status: failed
Test output