6464DELETE_WORKFLOW_STEPS = 2
6565DEACTIVATE_WORKFLOW_STEPS = 2
6666DEFAULT_RETRYING_REQUEST_ATTEMPTS = 3
67- TERMINAL_STATES = [State .ACTIVE , State .FAILED , State .DELETED , State .INACTIVE ]
6867
6968MODEL_DEPLOYMENT_KIND = "deployment"
7069MODEL_DEPLOYMENT_TYPE = "modelDeployment"
@@ -720,7 +719,7 @@ def update(
720719
721720 def watch (
722721 self ,
723- log_type : str = ModelDeploymentLogType . ACCESS ,
722+ log_type : str = None ,
724723 time_start : datetime = None ,
725724 interval : int = LOG_INTERVAL ,
726725 log_filter : str = None ,
@@ -731,7 +730,7 @@ def watch(
731730 ----------
732731 log_type: str, optional
733732 The log type. Can be `access`, `predict` or None.
734- Defaults to access .
733+ Defaults to None .
735734 time_start : datetime.datetime, optional
736735 Starting time for the log query.
737736 Defaults to None.
@@ -757,7 +756,7 @@ def watch(
757756 count = self .logs (log_type ).stream (
758757 source = self .model_deployment_id ,
759758 interval = interval ,
760- stop_condition = self ._stop_condition ,
759+ stop_condition = self ._stream_stop_condition ,
761760 time_start = time_start ,
762761 log_filter = log_filter ,
763762 )
@@ -773,7 +772,11 @@ def watch(
773772
774773 def _stop_condition (self ):
775774 """Stops the sync once the model deployment is in a terminal state."""
776- return self .state in TERMINAL_STATES
775+ return self .state in [State .ACTIVE , State .FAILED , State .DELETED , State .INACTIVE ]
776+
777+ def _stream_stop_condition (self ):
778+ """Stops the stream sync once the model deployment is in a terminal state."""
779+ return self .state in [State .FAILED , State .DELETED , State .INACTIVE ]
777780
778781 def _check_and_print_status (self , prev_status ) -> str :
779782 """Check and print the next status.
0 commit comments