diff --git a/instill/clients/client.py b/instill/clients/client.py index 51b9d7b..54ca1f9 100644 --- a/instill/clients/client.py +++ b/instill/clients/client.py @@ -6,7 +6,6 @@ from instill.utils.logger import Logger _mgmt_client = None -_connector_client = None _pipeline_client = None _model_client = None _client = None diff --git a/instill/clients/mgmt.py b/instill/clients/mgmt.py index e325b62..30a24fa 100644 --- a/instill/clients/mgmt.py +++ b/instill/clients/mgmt.py @@ -125,7 +125,7 @@ def get_user(self) -> mgmt_interface.User: resp: mgmt_interface.GetUserResponse = self.hosts[self.instance][ "client" ].GetUser( - request=mgmt_interface.GetUserRequest(), + request=mgmt_interface.GetUserRequest(name="users/me"), metadata=self.hosts[self.instance]["metadata"], ) return resp.user diff --git a/instill/clients/pipeline.py b/instill/clients/pipeline.py index 9309c2b..e4f7501 100644 --- a/instill/clients/pipeline.py +++ b/instill/clients/pipeline.py @@ -245,7 +245,7 @@ def trigger_async_pipeline( ) -> operations_pb2.Operation: resp: pipeline_interface.TriggerAsyncUserPipelineResponse = self.hosts[ self.instance - ]["client"].TriggerUserPipeline( + ]["client"].TriggerAsyncUserPipeline( request=pipeline_interface.TriggerAsyncUserPipelineRequest( name=f"{self.namespace}/pipelines/{name}", inputs=inputs ), diff --git a/instill/resources/pipeline.py b/instill/resources/pipeline.py index 188371b..34b7084 100644 --- a/instill/resources/pipeline.py +++ b/instill/resources/pipeline.py @@ -1,6 +1,8 @@ # pylint: disable=no-member,wrong-import-position,no-name-in-module from typing import Tuple, Union +from google.longrunning import operations_pb2 + import instill.protogen.vdp.pipeline.v1alpha.pipeline_pb2 as pipeline_interface from instill.clients import InstillClient from instill.resources.resource import Resource @@ -49,6 +51,14 @@ def resource(self, resource: pipeline_interface.Pipeline): def _update(self): self.resource = self.client.pipeline_service.get_pipeline(name=self.resource.id) + def get_operation(self, operation: operations_pb2.Operation): + return self.client.pipeline_service.get_operation(operation.name) + + def trigger_async(self, task_inputs: list) -> operations_pb2.Operation: + return self.client.pipeline_service.trigger_async_pipeline( + self.resource.id, task_inputs + ) + def get_recipe(self) -> str: return self.resource.recipe