diff --git a/google/cloud/aiplatform_v1/services/migration_service/client.py b/google/cloud/aiplatform_v1/services/migration_service/client.py index b43dcee16e..c42427af48 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/client.py +++ b/google/cloud/aiplatform_v1/services/migration_service/client.py @@ -230,40 +230,40 @@ def parse_dataset_path(path: str) -> Dict[str, str]: @staticmethod def dataset_path( project: str, - location: str, dataset: str, ) -> str: """Returns a fully-qualified dataset string.""" - return "projects/{project}/locations/{location}/datasets/{dataset}".format( + return "projects/{project}/datasets/{dataset}".format( project=project, - location=location, dataset=dataset, ) @staticmethod def parse_dataset_path(path: str) -> Dict[str, str]: """Parses a dataset path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)/datasets/(?P.+?)$", - path, - ) + m = re.match(r"^projects/(?P.+?)/datasets/(?P.+?)$", path) return m.groupdict() if m else {} @staticmethod def dataset_path( project: str, + location: str, dataset: str, ) -> str: """Returns a fully-qualified dataset string.""" - return "projects/{project}/datasets/{dataset}".format( + return "projects/{project}/locations/{location}/datasets/{dataset}".format( project=project, + location=location, dataset=dataset, ) @staticmethod def parse_dataset_path(path: str) -> Dict[str, str]: """Parses a dataset path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/datasets/(?P.+?)$", path) + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/datasets/(?P.+?)$", + path, + ) return m.groupdict() if m else {} @staticmethod diff --git a/google/cloud/aiplatform_v1/types/tensorboard.py b/google/cloud/aiplatform_v1/types/tensorboard.py index c8ce1105fa..f979b0b39b 100644 --- a/google/cloud/aiplatform_v1/types/tensorboard.py +++ b/google/cloud/aiplatform_v1/types/tensorboard.py @@ -84,6 +84,14 @@ class Tensorboard(proto.Message): Used to perform a consistent read-modify-write updates. If not set, a blind "overwrite" update happens. + is_default (bool): + Used to indicate if the TensorBoard instance + is the default one. Each project & region can + have at most one default TensorBoard instance. + Creation of a default TensorBoard instance and + updating an existing TensorBoard instance to be + default will mark all other TensorBoard + instances (if any) as non default. """ name: str = proto.Field( @@ -130,6 +138,10 @@ class Tensorboard(proto.Message): proto.STRING, number=9, ) + is_default: bool = proto.Field( + proto.BOOL, + number=12, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py index 4be06a9574..f6ca7d5f68 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py @@ -137,6 +137,10 @@ class JobServiceAsyncClient: ) network_path = staticmethod(JobServiceClient.network_path) parse_network_path = staticmethod(JobServiceClient.parse_network_path) + notification_channel_path = staticmethod(JobServiceClient.notification_channel_path) + parse_notification_channel_path = staticmethod( + JobServiceClient.parse_notification_channel_path + ) tensorboard_path = staticmethod(JobServiceClient.tensorboard_path) parse_tensorboard_path = staticmethod(JobServiceClient.parse_tensorboard_path) trial_path = staticmethod(JobServiceClient.trial_path) diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/client.py b/google/cloud/aiplatform_v1beta1/services/job_service/client.py index 8295020698..d103372c51 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/client.py @@ -457,6 +457,26 @@ def parse_network_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def notification_channel_path( + project: str, + notification_channel: str, + ) -> str: + """Returns a fully-qualified notification_channel string.""" + return "projects/{project}/notificationChannels/{notification_channel}".format( + project=project, + notification_channel=notification_channel, + ) + + @staticmethod + def parse_notification_channel_path(path: str) -> Dict[str, str]: + """Parses a notification_channel path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/notificationChannels/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def tensorboard_path( project: str, diff --git a/google/cloud/aiplatform_v1beta1/types/model_monitoring.py b/google/cloud/aiplatform_v1beta1/types/model_monitoring.py index d47e2eb6e0..336aa03739 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_monitoring.py +++ b/google/cloud/aiplatform_v1beta1/types/model_monitoring.py @@ -401,6 +401,10 @@ class ModelMonitoringAlertConfig(proto.Message): [google.cloud.aiplatform.logging.ModelMonitoringAnomaliesLogEntry][]. This can be further sinked to Pub/Sub or any other services supported by Cloud Logging. + notification_channels (MutableSequence[str]): + Resource names of the NotificationChannels to send alert. + Must be of the format + ``projects//notificationChannels/`` """ class EmailAlertConfig(proto.Message): @@ -426,6 +430,10 @@ class EmailAlertConfig(proto.Message): proto.BOOL, number=2, ) + notification_channels: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) class ThresholdConfig(proto.Message): diff --git a/google/cloud/aiplatform_v1beta1/types/tensorboard.py b/google/cloud/aiplatform_v1beta1/types/tensorboard.py index 52809838d3..ac07f07d5b 100644 --- a/google/cloud/aiplatform_v1beta1/types/tensorboard.py +++ b/google/cloud/aiplatform_v1beta1/types/tensorboard.py @@ -84,6 +84,14 @@ class Tensorboard(proto.Message): Used to perform a consistent read-modify-write updates. If not set, a blind "overwrite" update happens. + is_default (bool): + Used to indicate if the TensorBoard instance + is the default one. Each project & region can + have at most one default TensorBoard instance. + Creation of a default TensorBoard instance and + updating an existing TensorBoard instance to be + default will mark all other TensorBoard + instances (if any) as non default. """ name: str = proto.Field( @@ -130,6 +138,10 @@ class Tensorboard(proto.Message): proto.STRING, number=9, ) + is_default: bool = proto.Field( + proto.BOOL, + number=12, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index f61152d82c..2e7154fd4e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -255,7 +255,7 @@ def system(session): if system_test_folder_exists: session.run( "py.test", - "-v", # TODO(b/275569167) revert this flag once bug is fixed + "--quiet", f"--junitxml=system_{session.python}_sponge_log.xml", system_test_folder_path, *session.posargs, diff --git a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json index de0979b370..a1b733c2b2 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-aiplatform", - "version": "1.24.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json index d4db6c231d..5d1d8817ed 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-aiplatform", - "version": "1.24.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/tests/unit/gapic/aiplatform_v1/test_migration_service.py b/tests/unit/gapic/aiplatform_v1/test_migration_service.py index 8fc5db291f..9055645a91 100644 --- a/tests/unit/gapic/aiplatform_v1/test_migration_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_migration_service.py @@ -2030,22 +2030,19 @@ def test_parse_dataset_path(): def test_dataset_path(): project = "squid" - location = "clam" - dataset = "whelk" - expected = "projects/{project}/locations/{location}/datasets/{dataset}".format( + dataset = "clam" + expected = "projects/{project}/datasets/{dataset}".format( project=project, - location=location, dataset=dataset, ) - actual = MigrationServiceClient.dataset_path(project, location, dataset) + actual = MigrationServiceClient.dataset_path(project, dataset) assert expected == actual def test_parse_dataset_path(): expected = { - "project": "octopus", - "location": "oyster", - "dataset": "nudibranch", + "project": "whelk", + "dataset": "octopus", } path = MigrationServiceClient.dataset_path(**expected) @@ -2055,19 +2052,22 @@ def test_parse_dataset_path(): def test_dataset_path(): - project = "cuttlefish" - dataset = "mussel" - expected = "projects/{project}/datasets/{dataset}".format( + project = "oyster" + location = "nudibranch" + dataset = "cuttlefish" + expected = "projects/{project}/locations/{location}/datasets/{dataset}".format( project=project, + location=location, dataset=dataset, ) - actual = MigrationServiceClient.dataset_path(project, dataset) + actual = MigrationServiceClient.dataset_path(project, location, dataset) assert expected == actual def test_parse_dataset_path(): expected = { - "project": "winkle", + "project": "mussel", + "location": "winkle", "dataset": "nautilus", } path = MigrationServiceClient.dataset_path(**expected) diff --git a/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py b/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py index ae657165cb..1469bf12ff 100644 --- a/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py @@ -1007,6 +1007,7 @@ def test_get_tensorboard(request_type, transport: str = "grpc"): blob_storage_path_prefix="blob_storage_path_prefix_value", run_count=989, etag="etag_value", + is_default=True, ) response = client.get_tensorboard(request) @@ -1023,6 +1024,7 @@ def test_get_tensorboard(request_type, transport: str = "grpc"): assert response.blob_storage_path_prefix == "blob_storage_path_prefix_value" assert response.run_count == 989 assert response.etag == "etag_value" + assert response.is_default is True def test_get_tensorboard_empty_call(): @@ -1066,6 +1068,7 @@ async def test_get_tensorboard_async( blob_storage_path_prefix="blob_storage_path_prefix_value", run_count=989, etag="etag_value", + is_default=True, ) ) response = await client.get_tensorboard(request) @@ -1083,6 +1086,7 @@ async def test_get_tensorboard_async( assert response.blob_storage_path_prefix == "blob_storage_path_prefix_value" assert response.run_count == 989 assert response.etag == "etag_value" + assert response.is_default is True @pytest.mark.asyncio diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py index e3a6c84e8b..a4ea1e4fa7 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py @@ -12014,10 +12014,33 @@ def test_parse_network_path(): assert expected == actual -def test_tensorboard_path(): +def test_notification_channel_path(): project = "cuttlefish" - location = "mussel" - tensorboard = "winkle" + notification_channel = "mussel" + expected = "projects/{project}/notificationChannels/{notification_channel}".format( + project=project, + notification_channel=notification_channel, + ) + actual = JobServiceClient.notification_channel_path(project, notification_channel) + assert expected == actual + + +def test_parse_notification_channel_path(): + expected = { + "project": "winkle", + "notification_channel": "nautilus", + } + path = JobServiceClient.notification_channel_path(**expected) + + # Check that the path construction is reversible. + actual = JobServiceClient.parse_notification_channel_path(path) + assert expected == actual + + +def test_tensorboard_path(): + project = "scallop" + location = "abalone" + tensorboard = "squid" expected = ( "projects/{project}/locations/{location}/tensorboards/{tensorboard}".format( project=project, @@ -12031,9 +12054,9 @@ def test_tensorboard_path(): def test_parse_tensorboard_path(): expected = { - "project": "nautilus", - "location": "scallop", - "tensorboard": "abalone", + "project": "clam", + "location": "whelk", + "tensorboard": "octopus", } path = JobServiceClient.tensorboard_path(**expected) @@ -12043,10 +12066,10 @@ def test_parse_tensorboard_path(): def test_trial_path(): - project = "squid" - location = "clam" - study = "whelk" - trial = "octopus" + project = "oyster" + location = "nudibranch" + study = "cuttlefish" + trial = "mussel" expected = ( "projects/{project}/locations/{location}/studies/{study}/trials/{trial}".format( project=project, @@ -12061,10 +12084,10 @@ def test_trial_path(): def test_parse_trial_path(): expected = { - "project": "oyster", - "location": "nudibranch", - "study": "cuttlefish", - "trial": "mussel", + "project": "winkle", + "location": "nautilus", + "study": "scallop", + "trial": "abalone", } path = JobServiceClient.trial_path(**expected) @@ -12074,7 +12097,7 @@ def test_parse_trial_path(): def test_common_billing_account_path(): - billing_account = "winkle" + billing_account = "squid" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -12084,7 +12107,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "nautilus", + "billing_account": "clam", } path = JobServiceClient.common_billing_account_path(**expected) @@ -12094,7 +12117,7 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "scallop" + folder = "whelk" expected = "folders/{folder}".format( folder=folder, ) @@ -12104,7 +12127,7 @@ def test_common_folder_path(): def test_parse_common_folder_path(): expected = { - "folder": "abalone", + "folder": "octopus", } path = JobServiceClient.common_folder_path(**expected) @@ -12114,7 +12137,7 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "squid" + organization = "oyster" expected = "organizations/{organization}".format( organization=organization, ) @@ -12124,7 +12147,7 @@ def test_common_organization_path(): def test_parse_common_organization_path(): expected = { - "organization": "clam", + "organization": "nudibranch", } path = JobServiceClient.common_organization_path(**expected) @@ -12134,7 +12157,7 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "whelk" + project = "cuttlefish" expected = "projects/{project}".format( project=project, ) @@ -12144,7 +12167,7 @@ def test_common_project_path(): def test_parse_common_project_path(): expected = { - "project": "octopus", + "project": "mussel", } path = JobServiceClient.common_project_path(**expected) @@ -12154,8 +12177,8 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "oyster" - location = "nudibranch" + project = "winkle" + location = "nautilus" expected = "projects/{project}/locations/{location}".format( project=project, location=location, @@ -12166,8 +12189,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "cuttlefish", - "location": "mussel", + "project": "scallop", + "location": "abalone", } path = JobServiceClient.common_location_path(**expected) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py index be803bc82c..d6c8ff55b5 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py @@ -1004,6 +1004,7 @@ def test_get_tensorboard(request_type, transport: str = "grpc"): blob_storage_path_prefix="blob_storage_path_prefix_value", run_count=989, etag="etag_value", + is_default=True, ) response = client.get_tensorboard(request) @@ -1020,6 +1021,7 @@ def test_get_tensorboard(request_type, transport: str = "grpc"): assert response.blob_storage_path_prefix == "blob_storage_path_prefix_value" assert response.run_count == 989 assert response.etag == "etag_value" + assert response.is_default is True def test_get_tensorboard_empty_call(): @@ -1063,6 +1065,7 @@ async def test_get_tensorboard_async( blob_storage_path_prefix="blob_storage_path_prefix_value", run_count=989, etag="etag_value", + is_default=True, ) ) response = await client.get_tensorboard(request) @@ -1080,6 +1083,7 @@ async def test_get_tensorboard_async( assert response.blob_storage_path_prefix == "blob_storage_path_prefix_value" assert response.run_count == 989 assert response.etag == "etag_value" + assert response.is_default is True @pytest.mark.asyncio