@@ -52,6 +52,7 @@ def __init__(
5252 self .config = None
5353
5454 self ._dlq = DLQ (pipeline_id = self .pipeline_id , host = host )
55+ self .status : models .PipelineStatus | None = None
5556
5657 def get (self ) -> Pipeline :
5758 """Fetch a pipeline by its ID.
@@ -67,6 +68,7 @@ def get(self) -> Pipeline:
6768 "GET" , f"{ self .ENDPOINT } /{ self .pipeline_id } " , event_name = "PipelineGet"
6869 )
6970 self .config = models .PipelineConfig .model_validate (response .json ())
71+ self .status = models .PipelineStatus (response .json ()["status" ])
7072 self ._dlq = DLQ (pipeline_id = self .pipeline_id , host = self .host )
7173 return self
7274
@@ -94,6 +96,7 @@ def create(self) -> Pipeline:
9496 ),
9597 event_name = "PipelineCreated" ,
9698 )
99+ self .status = models .PipelineStatus .CREATED
97100 return self
98101
99102 except errors .ForbiddenError as e :
@@ -160,6 +163,7 @@ def delete(self, terminate: bool = True) -> None:
160163 self .get ()
161164 endpoint = f"{ self .ENDPOINT } /{ self .pipeline_id } /terminate"
162165 self ._request ("DELETE" , endpoint , event_name = "PipelineDeleted" )
166+ self .status = models .PipelineStatus .TERMINATING
163167
164168 def pause (self ) -> Pipeline :
165169 """Pauses the pipeline with the given ID.
@@ -191,11 +195,13 @@ def health(self) -> dict[str, Any]:
191195 Returns:
192196 dict: Pipeline health
193197 """
194- return self ._request (
198+ response = self ._request (
195199 "GET" ,
196200 f"{ self .ENDPOINT } /{ self .pipeline_id } /health" ,
197201 event_name = "PipelineHealth" ,
198202 ).json ()
203+ self .status = models .PipelineStatus (response ["overall_status" ])
204+ return response
199205
200206 def to_dict (self ) -> dict [str , Any ]:
201207 """Convert the pipeline configuration to a dictionary.
0 commit comments