64
64
DELETE_WORKFLOW_STEPS = 2
65
65
DEACTIVATE_WORKFLOW_STEPS = 2
66
66
DEFAULT_RETRYING_REQUEST_ATTEMPTS = 3
67
- TERMINAL_STATES = [State .ACTIVE , State .FAILED , State .DELETED , State .INACTIVE ]
68
67
69
68
MODEL_DEPLOYMENT_KIND = "deployment"
70
69
MODEL_DEPLOYMENT_TYPE = "modelDeployment"
@@ -720,7 +719,7 @@ def update(
720
719
721
720
def watch (
722
721
self ,
723
- log_type : str = ModelDeploymentLogType . ACCESS ,
722
+ log_type : str = None ,
724
723
time_start : datetime = None ,
725
724
interval : int = LOG_INTERVAL ,
726
725
log_filter : str = None ,
@@ -731,7 +730,7 @@ def watch(
731
730
----------
732
731
log_type: str, optional
733
732
The log type. Can be `access`, `predict` or None.
734
- Defaults to access .
733
+ Defaults to None .
735
734
time_start : datetime.datetime, optional
736
735
Starting time for the log query.
737
736
Defaults to None.
@@ -757,7 +756,7 @@ def watch(
757
756
count = self .logs (log_type ).stream (
758
757
source = self .model_deployment_id ,
759
758
interval = interval ,
760
- stop_condition = self ._stop_condition ,
759
+ stop_condition = self ._stream_stop_condition ,
761
760
time_start = time_start ,
762
761
log_filter = log_filter ,
763
762
)
@@ -773,7 +772,11 @@ def watch(
773
772
774
773
def _stop_condition (self ):
775
774
"""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 ]
777
780
778
781
def _check_and_print_status (self , prev_status ) -> str :
779
782
"""Check and print the next status.
0 commit comments