Skip to content

Commit

Permalink
fix!: delete the deprecated field for model monitor
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 627075504

Source-Link: googleapis/googleapis@5fa62a9

Source-Link: googleapis/googleapis-gen@a557727
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTU1NzcyN2E3Y2RjMzZiMDk4MmI3YTE1MDk5YWMyMDk3ZTAyNjVhZSJ9
  • Loading branch information
gcf-owl-bot[bot] committed Apr 22, 2024
1 parent 42980b9 commit 0a2bf40
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,25 +188,25 @@ def parse_annotated_dataset_path(path: str) -> Dict[str,str]:
return m.groupdict() if m else {}

@staticmethod
def dataset_path(project: str,location: str,dataset: str,) -> str:
def dataset_path(project: str,dataset: str,) -> str:
"""Returns a fully-qualified dataset string."""
return "projects/{project}/locations/{location}/datasets/{dataset}".format(project=project, location=location, dataset=dataset, )
return "projects/{project}/datasets/{dataset}".format(project=project, 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<project>.+?)/locations/(?P<location>.+?)/datasets/(?P<dataset>.+?)$", path)
m = re.match(r"^projects/(?P<project>.+?)/datasets/(?P<dataset>.+?)$", path)
return m.groupdict() if m else {}

@staticmethod
def dataset_path(project: str,dataset: str,) -> str:
def dataset_path(project: str,location: str,dataset: str,) -> str:
"""Returns a fully-qualified dataset string."""
return "projects/{project}/datasets/{dataset}".format(project=project, dataset=dataset, )
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<project>.+?)/datasets/(?P<dataset>.+?)$", path)
m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/datasets/(?P<dataset>.+?)$", path)
return m.groupdict() if m else {}

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,6 @@ class ModelMonitoringSchema(proto.Message):
analyzed.
ground_truth_fields (MutableSequence[google.cloud.aiplatform_v1beta1.types.ModelMonitoringSchema.FieldSchema]):
Target /ground truth names of the model.
instance_type (str):
The prediction instance type that the Model accepts when
serving. Supported values are:
- ``object``: Each input is a JSON object format.
- ``array``: Each input is a JSON array format.
"""

class FieldSchema(proto.Message):
Expand Down Expand Up @@ -292,10 +286,6 @@ class FieldSchema(proto.Message):
number=3,
message=FieldSchema,
)
instance_type: str = proto.Field(
proto.STRING,
number=4,
)


__all__ = tuple(sorted(__protobuf__.manifest))
Original file line number Diff line number Diff line change
Expand Up @@ -2627,18 +2627,16 @@ def test_parse_annotated_dataset_path():

def test_dataset_path():
project = "cuttlefish"
location = "mussel"
dataset = "winkle"
expected = "projects/{project}/locations/{location}/datasets/{dataset}".format(project=project, location=location, dataset=dataset, )
actual = MigrationServiceClient.dataset_path(project, location, dataset)
dataset = "mussel"
expected = "projects/{project}/datasets/{dataset}".format(project=project, dataset=dataset, )
actual = MigrationServiceClient.dataset_path(project, dataset)
assert expected == actual


def test_parse_dataset_path():
expected = {
"project": "nautilus",
"location": "scallop",
"dataset": "abalone",
"project": "winkle",
"dataset": "nautilus",
}
path = MigrationServiceClient.dataset_path(**expected)

Expand All @@ -2647,16 +2645,18 @@ def test_parse_dataset_path():
assert expected == actual

def test_dataset_path():
project = "squid"
dataset = "clam"
expected = "projects/{project}/datasets/{dataset}".format(project=project, dataset=dataset, )
actual = MigrationServiceClient.dataset_path(project, dataset)
project = "scallop"
location = "abalone"
dataset = "squid"
expected = "projects/{project}/locations/{location}/datasets/{dataset}".format(project=project, location=location, dataset=dataset, )
actual = MigrationServiceClient.dataset_path(project, location, dataset)
assert expected == actual


def test_parse_dataset_path():
expected = {
"project": "whelk",
"project": "clam",
"location": "whelk",
"dataset": "octopus",
}
path = MigrationServiceClient.dataset_path(**expected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4763,7 +4763,7 @@ def test_create_model_monitor_rest(request_type):

# send a request that will satisfy transcoding
request_init = {'parent': 'projects/sample1/locations/sample2'}
request_init["model_monitor"] = {'tabular_objective': {'feature_drift_spec': {'features': ['features_value1', 'features_value2'], 'categorical_metric_type': 'categorical_metric_type_value', 'numeric_metric_type': 'numeric_metric_type_value', 'default_categorical_alert_condition': {'threshold': 0.973}, 'default_numeric_alert_condition': {}, 'feature_alert_conditions': {}}, 'prediction_output_drift_spec': {}, 'feature_attribution_spec': {'features': ['features_value1', 'features_value2'], 'default_alert_condition': {}, 'feature_alert_conditions': {}, 'batch_explanation_dedicated_resources': {'machine_spec': {'machine_type': 'machine_type_value', 'accelerator_type': 1, 'accelerator_count': 1805, 'tpu_topology': 'tpu_topology_value'}, 'starting_replica_count': 2355, 'max_replica_count': 1805}}}, 'name': 'name_value', 'display_name': 'display_name_value', 'model_monitoring_target': {'vertex_model': {'model': 'model_value', 'model_version_id': 'model_version_id_value'}}, 'training_dataset': {'columnized_dataset': {'vertex_dataset': 'vertex_dataset_value', 'gcs_source': {'gcs_uri': 'gcs_uri_value', 'format_': 1}, 'bigquery_source': {'table_uri': 'table_uri_value', 'query': 'query_value'}, 'timestamp_field': 'timestamp_field_value'}, 'batch_prediction_output': {'batch_prediction_job': 'batch_prediction_job_value'}, 'vertex_endpoint_logs': {'endpoints': ['endpoints_value1', 'endpoints_value2']}, 'time_interval': {'start_time': {'seconds': 751, 'nanos': 543}, 'end_time': {}}, 'time_offset': {'offset': 'offset_value', 'window': 'window_value'}}, 'notification_spec': {'email_config': {'user_emails': ['user_emails_value1', 'user_emails_value2']}, 'enable_cloud_logging': True, 'notification_channel_configs': [{'notification_channel': 'notification_channel_value'}]}, 'output_spec': {'gcs_base_directory': {'output_uri_prefix': 'output_uri_prefix_value'}}, 'explanation_spec': {'parameters': {'sampled_shapley_attribution': {'path_count': 1077}, 'integrated_gradients_attribution': {'step_count': 1092, 'smooth_grad_config': {'noise_sigma': 0.11660000000000001, 'feature_noise_sigma': {'noise_sigma': [{'name': 'name_value', 'sigma': 0.529}]}, 'noisy_sample_count': 1947}, 'blur_baseline_config': {'max_blur_sigma': 0.1482}}, 'xrai_attribution': {'step_count': 1092, 'smooth_grad_config': {}, 'blur_baseline_config': {}}, 'examples': {'example_gcs_source': {'data_format': 1, 'gcs_source': {'uris': ['uris_value1', 'uris_value2']}}, 'nearest_neighbor_search_config': {'null_value': 0, 'number_value': 0.1285, 'string_value': 'string_value_value', 'bool_value': True, 'struct_value': {'fields': {}}, 'list_value': {'values': {}}}, 'presets': {'query': 1, 'modality': 1}, 'gcs_source': {}, 'neighbor_count': 1494}, 'top_k': 541, 'output_indices': {}}, 'metadata': {'inputs': {}, 'outputs': {}, 'feature_attributions_schema_uri': 'feature_attributions_schema_uri_value', 'latent_space_source': 'latent_space_source_value'}}, 'model_monitoring_schema': {'feature_fields': [{'name': 'name_value', 'data_type': 'data_type_value', 'repeated': True}], 'prediction_fields': {}, 'ground_truth_fields': {}, 'instance_type': 'instance_type_value'}, 'create_time': {}, 'update_time': {}}
request_init["model_monitor"] = {'tabular_objective': {'feature_drift_spec': {'features': ['features_value1', 'features_value2'], 'categorical_metric_type': 'categorical_metric_type_value', 'numeric_metric_type': 'numeric_metric_type_value', 'default_categorical_alert_condition': {'threshold': 0.973}, 'default_numeric_alert_condition': {}, 'feature_alert_conditions': {}}, 'prediction_output_drift_spec': {}, 'feature_attribution_spec': {'features': ['features_value1', 'features_value2'], 'default_alert_condition': {}, 'feature_alert_conditions': {}, 'batch_explanation_dedicated_resources': {'machine_spec': {'machine_type': 'machine_type_value', 'accelerator_type': 1, 'accelerator_count': 1805, 'tpu_topology': 'tpu_topology_value'}, 'starting_replica_count': 2355, 'max_replica_count': 1805}}}, 'name': 'name_value', 'display_name': 'display_name_value', 'model_monitoring_target': {'vertex_model': {'model': 'model_value', 'model_version_id': 'model_version_id_value'}}, 'training_dataset': {'columnized_dataset': {'vertex_dataset': 'vertex_dataset_value', 'gcs_source': {'gcs_uri': 'gcs_uri_value', 'format_': 1}, 'bigquery_source': {'table_uri': 'table_uri_value', 'query': 'query_value'}, 'timestamp_field': 'timestamp_field_value'}, 'batch_prediction_output': {'batch_prediction_job': 'batch_prediction_job_value'}, 'vertex_endpoint_logs': {'endpoints': ['endpoints_value1', 'endpoints_value2']}, 'time_interval': {'start_time': {'seconds': 751, 'nanos': 543}, 'end_time': {}}, 'time_offset': {'offset': 'offset_value', 'window': 'window_value'}}, 'notification_spec': {'email_config': {'user_emails': ['user_emails_value1', 'user_emails_value2']}, 'enable_cloud_logging': True, 'notification_channel_configs': [{'notification_channel': 'notification_channel_value'}]}, 'output_spec': {'gcs_base_directory': {'output_uri_prefix': 'output_uri_prefix_value'}}, 'explanation_spec': {'parameters': {'sampled_shapley_attribution': {'path_count': 1077}, 'integrated_gradients_attribution': {'step_count': 1092, 'smooth_grad_config': {'noise_sigma': 0.11660000000000001, 'feature_noise_sigma': {'noise_sigma': [{'name': 'name_value', 'sigma': 0.529}]}, 'noisy_sample_count': 1947}, 'blur_baseline_config': {'max_blur_sigma': 0.1482}}, 'xrai_attribution': {'step_count': 1092, 'smooth_grad_config': {}, 'blur_baseline_config': {}}, 'examples': {'example_gcs_source': {'data_format': 1, 'gcs_source': {'uris': ['uris_value1', 'uris_value2']}}, 'nearest_neighbor_search_config': {'null_value': 0, 'number_value': 0.1285, 'string_value': 'string_value_value', 'bool_value': True, 'struct_value': {'fields': {}}, 'list_value': {'values': {}}}, 'presets': {'query': 1, 'modality': 1}, 'gcs_source': {}, 'neighbor_count': 1494}, 'top_k': 541, 'output_indices': {}}, 'metadata': {'inputs': {}, 'outputs': {}, 'feature_attributions_schema_uri': 'feature_attributions_schema_uri_value', 'latent_space_source': 'latent_space_source_value'}}, 'model_monitoring_schema': {'feature_fields': [{'name': 'name_value', 'data_type': 'data_type_value', 'repeated': True}], 'prediction_fields': {}, 'ground_truth_fields': {}}, 'create_time': {}, 'update_time': {}}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
# See https://github.com/googleapis/gapic-generator-python/issues/1748
Expand Down Expand Up @@ -5057,7 +5057,7 @@ def test_update_model_monitor_rest(request_type):

# send a request that will satisfy transcoding
request_init = {'model_monitor': {'name': 'projects/sample1/locations/sample2/modelMonitors/sample3'}}
request_init["model_monitor"] = {'tabular_objective': {'feature_drift_spec': {'features': ['features_value1', 'features_value2'], 'categorical_metric_type': 'categorical_metric_type_value', 'numeric_metric_type': 'numeric_metric_type_value', 'default_categorical_alert_condition': {'threshold': 0.973}, 'default_numeric_alert_condition': {}, 'feature_alert_conditions': {}}, 'prediction_output_drift_spec': {}, 'feature_attribution_spec': {'features': ['features_value1', 'features_value2'], 'default_alert_condition': {}, 'feature_alert_conditions': {}, 'batch_explanation_dedicated_resources': {'machine_spec': {'machine_type': 'machine_type_value', 'accelerator_type': 1, 'accelerator_count': 1805, 'tpu_topology': 'tpu_topology_value'}, 'starting_replica_count': 2355, 'max_replica_count': 1805}}}, 'name': 'projects/sample1/locations/sample2/modelMonitors/sample3', 'display_name': 'display_name_value', 'model_monitoring_target': {'vertex_model': {'model': 'model_value', 'model_version_id': 'model_version_id_value'}}, 'training_dataset': {'columnized_dataset': {'vertex_dataset': 'vertex_dataset_value', 'gcs_source': {'gcs_uri': 'gcs_uri_value', 'format_': 1}, 'bigquery_source': {'table_uri': 'table_uri_value', 'query': 'query_value'}, 'timestamp_field': 'timestamp_field_value'}, 'batch_prediction_output': {'batch_prediction_job': 'batch_prediction_job_value'}, 'vertex_endpoint_logs': {'endpoints': ['endpoints_value1', 'endpoints_value2']}, 'time_interval': {'start_time': {'seconds': 751, 'nanos': 543}, 'end_time': {}}, 'time_offset': {'offset': 'offset_value', 'window': 'window_value'}}, 'notification_spec': {'email_config': {'user_emails': ['user_emails_value1', 'user_emails_value2']}, 'enable_cloud_logging': True, 'notification_channel_configs': [{'notification_channel': 'notification_channel_value'}]}, 'output_spec': {'gcs_base_directory': {'output_uri_prefix': 'output_uri_prefix_value'}}, 'explanation_spec': {'parameters': {'sampled_shapley_attribution': {'path_count': 1077}, 'integrated_gradients_attribution': {'step_count': 1092, 'smooth_grad_config': {'noise_sigma': 0.11660000000000001, 'feature_noise_sigma': {'noise_sigma': [{'name': 'name_value', 'sigma': 0.529}]}, 'noisy_sample_count': 1947}, 'blur_baseline_config': {'max_blur_sigma': 0.1482}}, 'xrai_attribution': {'step_count': 1092, 'smooth_grad_config': {}, 'blur_baseline_config': {}}, 'examples': {'example_gcs_source': {'data_format': 1, 'gcs_source': {'uris': ['uris_value1', 'uris_value2']}}, 'nearest_neighbor_search_config': {'null_value': 0, 'number_value': 0.1285, 'string_value': 'string_value_value', 'bool_value': True, 'struct_value': {'fields': {}}, 'list_value': {'values': {}}}, 'presets': {'query': 1, 'modality': 1}, 'gcs_source': {}, 'neighbor_count': 1494}, 'top_k': 541, 'output_indices': {}}, 'metadata': {'inputs': {}, 'outputs': {}, 'feature_attributions_schema_uri': 'feature_attributions_schema_uri_value', 'latent_space_source': 'latent_space_source_value'}}, 'model_monitoring_schema': {'feature_fields': [{'name': 'name_value', 'data_type': 'data_type_value', 'repeated': True}], 'prediction_fields': {}, 'ground_truth_fields': {}, 'instance_type': 'instance_type_value'}, 'create_time': {}, 'update_time': {}}
request_init["model_monitor"] = {'tabular_objective': {'feature_drift_spec': {'features': ['features_value1', 'features_value2'], 'categorical_metric_type': 'categorical_metric_type_value', 'numeric_metric_type': 'numeric_metric_type_value', 'default_categorical_alert_condition': {'threshold': 0.973}, 'default_numeric_alert_condition': {}, 'feature_alert_conditions': {}}, 'prediction_output_drift_spec': {}, 'feature_attribution_spec': {'features': ['features_value1', 'features_value2'], 'default_alert_condition': {}, 'feature_alert_conditions': {}, 'batch_explanation_dedicated_resources': {'machine_spec': {'machine_type': 'machine_type_value', 'accelerator_type': 1, 'accelerator_count': 1805, 'tpu_topology': 'tpu_topology_value'}, 'starting_replica_count': 2355, 'max_replica_count': 1805}}}, 'name': 'projects/sample1/locations/sample2/modelMonitors/sample3', 'display_name': 'display_name_value', 'model_monitoring_target': {'vertex_model': {'model': 'model_value', 'model_version_id': 'model_version_id_value'}}, 'training_dataset': {'columnized_dataset': {'vertex_dataset': 'vertex_dataset_value', 'gcs_source': {'gcs_uri': 'gcs_uri_value', 'format_': 1}, 'bigquery_source': {'table_uri': 'table_uri_value', 'query': 'query_value'}, 'timestamp_field': 'timestamp_field_value'}, 'batch_prediction_output': {'batch_prediction_job': 'batch_prediction_job_value'}, 'vertex_endpoint_logs': {'endpoints': ['endpoints_value1', 'endpoints_value2']}, 'time_interval': {'start_time': {'seconds': 751, 'nanos': 543}, 'end_time': {}}, 'time_offset': {'offset': 'offset_value', 'window': 'window_value'}}, 'notification_spec': {'email_config': {'user_emails': ['user_emails_value1', 'user_emails_value2']}, 'enable_cloud_logging': True, 'notification_channel_configs': [{'notification_channel': 'notification_channel_value'}]}, 'output_spec': {'gcs_base_directory': {'output_uri_prefix': 'output_uri_prefix_value'}}, 'explanation_spec': {'parameters': {'sampled_shapley_attribution': {'path_count': 1077}, 'integrated_gradients_attribution': {'step_count': 1092, 'smooth_grad_config': {'noise_sigma': 0.11660000000000001, 'feature_noise_sigma': {'noise_sigma': [{'name': 'name_value', 'sigma': 0.529}]}, 'noisy_sample_count': 1947}, 'blur_baseline_config': {'max_blur_sigma': 0.1482}}, 'xrai_attribution': {'step_count': 1092, 'smooth_grad_config': {}, 'blur_baseline_config': {}}, 'examples': {'example_gcs_source': {'data_format': 1, 'gcs_source': {'uris': ['uris_value1', 'uris_value2']}}, 'nearest_neighbor_search_config': {'null_value': 0, 'number_value': 0.1285, 'string_value': 'string_value_value', 'bool_value': True, 'struct_value': {'fields': {}}, 'list_value': {'values': {}}}, 'presets': {'query': 1, 'modality': 1}, 'gcs_source': {}, 'neighbor_count': 1494}, 'top_k': 541, 'output_indices': {}}, 'metadata': {'inputs': {}, 'outputs': {}, 'feature_attributions_schema_uri': 'feature_attributions_schema_uri_value', 'latent_space_source': 'latent_space_source_value'}}, 'model_monitoring_schema': {'feature_fields': [{'name': 'name_value', 'data_type': 'data_type_value', 'repeated': True}], 'prediction_fields': {}, 'ground_truth_fields': {}}, 'create_time': {}, 'update_time': {}}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
# See https://github.com/googleapis/gapic-generator-python/issues/1748
Expand Down

0 comments on commit 0a2bf40

Please sign in to comment.