Skip to content

Commit

Permalink
fixing errors with runtime type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
rosiezou committed Jun 15, 2022
1 parent 79b8b78 commit a5d2b08
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions google/cloud/aiplatform/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1957,12 +1957,12 @@ def __init__(

@classmethod
def _get_endpoint_resource_name(cls, endpoint: Union[str, "aiplatform.Endpoint"]):
endpoint_resource_string = None
endpoint_resource_string = ""
if isinstance(endpoint, str):
if re.match(r"[0-9]", endpoint):
parent = aiplatform.initializer.global_config.common_location_path()
endpoint_resource_string = f"{parent}/endpoints/{endpoint}"
elif re.match(r"projects/*/locations/*/endpoints/*", endpoint):
elif re.match(r"projects/.+?/locations/.+?/endpoints/.+?", endpoint):
endpoint_resource_string = endpoint
elif isinstance(endpoint, aiplatform.Endpoint):
endpoint_resource_string = endpoint.resource_name
Expand Down Expand Up @@ -2244,7 +2244,6 @@ def create(
_LOGGER.log_create_with_lro(cls)

endpoint_resource_name = cls._get_endpoint_resource_name(endpoint)

gapic_mdm_job = (
gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob(
display_name=display_name,
Expand Down Expand Up @@ -2286,8 +2285,6 @@ def create(

def update(
self,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
display_name: Optional[str] = None,
schedule_config: Optional[model_monitoring.ScheduleConfig] = None,
alert_config: Optional[model_monitoring.EmailAlertConfig] = None,
Expand Down
6 changes: 3 additions & 3 deletions google/cloud/aiplatform/model_monitoring/objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def __init__(
def as_proto(self):
training_dataset = None
if self.skew_detection_config is not None:
training_dataset = self.training_dataset
training_dataset = self.skew_detection_config.training_dataset
return gca_model_monitoring.ModelMonitoringObjectiveConfig(
training_dataset=training_dataset,
training_prediction_skew_detection_config=self.skew_detection_config.as_proto()
Expand Down Expand Up @@ -196,14 +196,14 @@ def __init__(
super().__init__(
data_source,
skew_thresholds,
target_field,
attribute_skew_thresholds,
data_format,
target_field,
)

training_dataset = (
gca_model_monitoring.ModelMonitoringObjectiveConfig.TrainingDataset(
target_field=self.skew_detection_config.target_field
target_field=target_field
)
)
if data_source.startswith("bq:/"):
Expand Down

0 comments on commit a5d2b08

Please sign in to comment.