Skip to content

Commit e5d087f

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
chore: change the Model Monitoring Job sync option default value
PiperOrigin-RevId: 653793790
1 parent 259b638 commit e5d087f

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

tests/unit/vertexai/test_model_monitors.py

+5
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@ def test_run_model_monitoring_job_with_user_id(
972972
parameters=explanation.ExplanationParameters(top_k=10)
973973
),
974974
model_monitoring_job_id=_TEST_MODEL_MONITORING_JOB_USER_ID,
975+
sync=True,
975976
)
976977
create_model_monitoring_job_mock.assert_called_once_with(
977978
request=gca_model_monitoring_service.CreateModelMonitoringJobRequest(
@@ -1016,6 +1017,7 @@ def test_search_metrics(self, search_metrics_mock):
10161017
target_dataset=ml_monitoring.spec.MonitoringInput(
10171018
vertex_dataset=_TEST_TARGET_RESOURCE
10181019
),
1020+
sync=True,
10191021
)
10201022
test_model_monitor.search_metrics(
10211023
model_monitoring_job_name=_TEST_MODEL_MONITORING_JOB_RESOURCE_NAME
@@ -1057,6 +1059,7 @@ def test_search_alerts(self, search_alerts_mock):
10571059
target_dataset=ml_monitoring.spec.MonitoringInput(
10581060
vertex_dataset=_TEST_TARGET_RESOURCE
10591061
),
1062+
sync=True,
10601063
)
10611064
test_model_monitor.search_alerts(
10621065
model_monitoring_job_name=_TEST_MODEL_MONITORING_JOB_RESOURCE_NAME
@@ -1172,6 +1175,7 @@ def test_delete_model_monitoring_job(self, delete_model_monitoring_job_mock):
11721175
notification_spec=ml_monitoring.spec.NotificationSpec(
11731176
user_emails=[_TEST_NOTIFICATION_EMAIL]
11741177
),
1178+
sync=True,
11751179
)
11761180
test_job.delete()
11771181
delete_model_monitoring_job_mock.assert_called_once_with(
@@ -1212,6 +1216,7 @@ def test_get_model_monitoring_job(self):
12121216
target_dataset=ml_monitoring.spec.MonitoringInput(
12131217
vertex_dataset=_TEST_TARGET_RESOURCE
12141218
),
1219+
sync=True,
12151220
)
12161221
test_model_monitoring_job = test_model_monitor.get_model_monitoring_job(
12171222
model_monitoring_job_name=_TEST_MODEL_MONITORING_JOB_RESOURCE_NAME

vertexai/resources/preview/ml_monitoring/model_monitors.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ def run(
11191119
target_dataset: objective.MonitoringInput,
11201120
display_name: Optional[str] = None,
11211121
model_monitoring_job_id: Optional[str] = None,
1122-
sync: Optional[bool] = True,
1122+
sync: Optional[bool] = False,
11231123
tabular_objective_spec: Optional[objective.TabularObjective] = None,
11241124
baseline_dataset: Optional[objective.MonitoringInput] = None,
11251125
output_spec: Optional[output.OutputSpec] = None,
@@ -1146,7 +1146,7 @@ def run(
11461146
Whether to execute this method synchronously. If False, this
11471147
method will be executed in concurrent Future and any downstream
11481148
object will be immediately returned and synced when the Future
1149-
has completed. Default is True.
1149+
has completed. Default is False.
11501150
tabular_objective_spec (objective.TabularObjective):
11511151
Optional. The tabular monitoring objective spec for the model
11521152
monitoring job.
@@ -1730,7 +1730,7 @@ def create(
17301730
output_spec: Optional[output.OutputSpec] = None,
17311731
notification_spec: Optional[notification.NotificationSpec] = None,
17321732
explanation_spec: Optional[explanation.ExplanationSpec] = None,
1733-
sync: bool = True,
1733+
sync: bool = False,
17341734
) -> "ModelMonitoringJob":
17351735
"""Creates a new ModelMonitoringJob.
17361736
@@ -1780,7 +1780,7 @@ def create(
17801780
Required. Whether to execute this method synchronously. If False, this
17811781
method will be executed in concurrent Future and any downstream
17821782
object will be immediately returned and synced when the Future
1783-
has completed. Default is True.
1783+
has completed. Default is False.
17841784
Returns:
17851785
ModelMonitoringJob: The model monitoring job that was created.
17861786
"""
@@ -1846,7 +1846,7 @@ def _submit_job(
18461846
model_monitor_name: str,
18471847
empty_model_monitoring_job: "ModelMonitoringJob",
18481848
gca_model_monitoring_job: gca_model_monitoring_job_compat.ModelMonitoringJob,
1849-
sync: bool = True,
1849+
sync: bool = False,
18501850
model_monitoring_job_id: Optional[str] = None,
18511851
project: Optional[str] = None,
18521852
location: Optional[str] = None,
@@ -1866,7 +1866,7 @@ def _submit_job(
18661866
Required. Whether to execute this method synchronously. If False, this
18671867
method will be executed in concurrent Future and any downstream
18681868
object will be immediately returned and synced when the Future
1869-
has completed. Default is True.
1869+
has completed. Default is False.
18701870
model_monitoring_job_id (str):
18711871
Optional. The unique ID of the model monitoring job run, which
18721872
will become the final component of the model monitoring job
@@ -1891,6 +1891,7 @@ def _submit_job(
18911891
credentials=credentials,
18921892
location_override=location,
18931893
)
1894+
_LOGGER.log_create_with_lro(cls)
18941895
created_model_monitoring_job = api_client.create_model_monitoring_job(
18951896
request=model_monitoring_service.CreateModelMonitoringJobRequest(
18961897
parent=model_monitor_name,

0 commit comments

Comments
 (0)