diff --git a/instill/clients/pipeline.py b/instill/clients/pipeline.py index 1654d21..ad80a1a 100644 --- a/instill/clients/pipeline.py +++ b/instill/clients/pipeline.py @@ -203,7 +203,8 @@ def get_pipeline( return RequestFactory( method=self.hosts[self.instance].async_client.GetUserPipeline, request=pipeline_interface.GetUserPipelineRequest( - name=f"{self.target_namespace}/pipelines/{name}" + name=f"{self.target_namespace}/pipelines/{name}", + view=pipeline_interface.Pipeline.VIEW_FULL, ), metadata=self.hosts[self.instance].metadata, ).send_async() @@ -211,7 +212,8 @@ def get_pipeline( return RequestFactory( method=self.hosts[self.instance].client.GetUserPipeline, request=pipeline_interface.GetUserPipelineRequest( - name=f"{self.target_namespace}/pipelines/{name}" + name=f"{self.target_namespace}/pipelines/{name}", + view=pipeline_interface.Pipeline.VIEW_FULL, ), metadata=self.hosts[self.instance].metadata, ).send_sync() diff --git a/instill/resources/pipeline.py b/instill/resources/pipeline.py index a7b0154..a86e13a 100644 --- a/instill/resources/pipeline.py +++ b/instill/resources/pipeline.py @@ -3,6 +3,7 @@ import grpc from google.longrunning import operations_pb2 +from google.protobuf.field_mask_pb2 import FieldMask import instill.protogen.vdp.pipeline.v1beta.pipeline_pb2 as pipeline_interface from instill.clients import InstillClient @@ -66,9 +67,17 @@ def trigger_async(self, task_inputs: list) -> operations_pb2.Operation: self.resource.id, task_inputs ).operation - def get_recipe(self) -> str: + def get_recipe(self) -> pipeline_interface.Recipe: return self.resource.recipe + def update_recipe(self, recipe: pipeline_interface.Recipe): + pipeline = self.resource + pipeline.recipe.CopyFrom(recipe) + self.client.pipeline_service.update_pipeline( + pipeline, FieldMask(paths=["recipe"]) + ) + self._update() + def validate_pipeline(self) -> bool: try: self.client.pipeline_service.validate_pipeline(