Skip to content

Commit

Permalink
chore: change the Model Monitoring Job sync option default value
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 653793790
  • Loading branch information
vertex-sdk-bot authored and copybara-github committed Jul 18, 2024
1 parent 259b638 commit e5d087f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions tests/unit/vertexai/test_model_monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,7 @@ def test_run_model_monitoring_job_with_user_id(
parameters=explanation.ExplanationParameters(top_k=10)
),
model_monitoring_job_id=_TEST_MODEL_MONITORING_JOB_USER_ID,
sync=True,
)
create_model_monitoring_job_mock.assert_called_once_with(
request=gca_model_monitoring_service.CreateModelMonitoringJobRequest(
Expand Down Expand Up @@ -1016,6 +1017,7 @@ def test_search_metrics(self, search_metrics_mock):
target_dataset=ml_monitoring.spec.MonitoringInput(
vertex_dataset=_TEST_TARGET_RESOURCE
),
sync=True,
)
test_model_monitor.search_metrics(
model_monitoring_job_name=_TEST_MODEL_MONITORING_JOB_RESOURCE_NAME
Expand Down Expand Up @@ -1057,6 +1059,7 @@ def test_search_alerts(self, search_alerts_mock):
target_dataset=ml_monitoring.spec.MonitoringInput(
vertex_dataset=_TEST_TARGET_RESOURCE
),
sync=True,
)
test_model_monitor.search_alerts(
model_monitoring_job_name=_TEST_MODEL_MONITORING_JOB_RESOURCE_NAME
Expand Down Expand Up @@ -1172,6 +1175,7 @@ def test_delete_model_monitoring_job(self, delete_model_monitoring_job_mock):
notification_spec=ml_monitoring.spec.NotificationSpec(
user_emails=[_TEST_NOTIFICATION_EMAIL]
),
sync=True,
)
test_job.delete()
delete_model_monitoring_job_mock.assert_called_once_with(
Expand Down Expand Up @@ -1212,6 +1216,7 @@ def test_get_model_monitoring_job(self):
target_dataset=ml_monitoring.spec.MonitoringInput(
vertex_dataset=_TEST_TARGET_RESOURCE
),
sync=True,
)
test_model_monitoring_job = test_model_monitor.get_model_monitoring_job(
model_monitoring_job_name=_TEST_MODEL_MONITORING_JOB_RESOURCE_NAME
Expand Down
13 changes: 7 additions & 6 deletions vertexai/resources/preview/ml_monitoring/model_monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ def run(
target_dataset: objective.MonitoringInput,
display_name: Optional[str] = None,
model_monitoring_job_id: Optional[str] = None,
sync: Optional[bool] = True,
sync: Optional[bool] = False,
tabular_objective_spec: Optional[objective.TabularObjective] = None,
baseline_dataset: Optional[objective.MonitoringInput] = None,
output_spec: Optional[output.OutputSpec] = None,
Expand All @@ -1146,7 +1146,7 @@ def run(
Whether to execute this method synchronously. If False, this
method will be executed in concurrent Future and any downstream
object will be immediately returned and synced when the Future
has completed. Default is True.
has completed. Default is False.
tabular_objective_spec (objective.TabularObjective):
Optional. The tabular monitoring objective spec for the model
monitoring job.
Expand Down Expand Up @@ -1730,7 +1730,7 @@ def create(
output_spec: Optional[output.OutputSpec] = None,
notification_spec: Optional[notification.NotificationSpec] = None,
explanation_spec: Optional[explanation.ExplanationSpec] = None,
sync: bool = True,
sync: bool = False,
) -> "ModelMonitoringJob":
"""Creates a new ModelMonitoringJob.
Expand Down Expand Up @@ -1780,7 +1780,7 @@ def create(
Required. Whether to execute this method synchronously. If False, this
method will be executed in concurrent Future and any downstream
object will be immediately returned and synced when the Future
has completed. Default is True.
has completed. Default is False.
Returns:
ModelMonitoringJob: The model monitoring job that was created.
"""
Expand Down Expand Up @@ -1846,7 +1846,7 @@ def _submit_job(
model_monitor_name: str,
empty_model_monitoring_job: "ModelMonitoringJob",
gca_model_monitoring_job: gca_model_monitoring_job_compat.ModelMonitoringJob,
sync: bool = True,
sync: bool = False,
model_monitoring_job_id: Optional[str] = None,
project: Optional[str] = None,
location: Optional[str] = None,
Expand All @@ -1866,7 +1866,7 @@ def _submit_job(
Required. Whether to execute this method synchronously. If False, this
method will be executed in concurrent Future and any downstream
object will be immediately returned and synced when the Future
has completed. Default is True.
has completed. Default is False.
model_monitoring_job_id (str):
Optional. The unique ID of the model monitoring job run, which
will become the final component of the model monitoring job
Expand All @@ -1891,6 +1891,7 @@ def _submit_job(
credentials=credentials,
location_override=location,
)
_LOGGER.log_create_with_lro(cls)
created_model_monitoring_job = api_client.create_model_monitoring_job(
request=model_monitoring_service.CreateModelMonitoringJobRequest(
parent=model_monitor_name,
Expand Down

0 comments on commit e5d087f

Please sign in to comment.