Skip to content

Commit

Permalink
chore(vdp): adopt the latest endpoints, merge connector endpoints int…
Browse files Browse the repository at this point in the history
…o pipeline
  • Loading branch information
donch1989 committed Nov 24, 2023
1 parent cea6b59 commit 8e7cc40
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 291 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ You can check the readiness of each service:
```python
client.mgmt_service.is_serving()
# True
client.connector_service.is_serving()
# True
client.pipeline_service.is_serving()
# True
client.model_service.is_serving()
Expand Down Expand Up @@ -344,14 +342,14 @@ instill_model = InstillModelConnector(
After the connector is created, the state should be `STATE_DISCONNECTED`

```python
instill_model.get_state() == connector_pb.ConnectorResource.STATE_DISCONNECTED
instill_model.get_state() == connector_pb.Connector.STATE_DISCONNECTED
# True
```

Now we can test the connection for the newly configured connector, to make sure the connection with the host can be established

```python
instill_model.test() == connector_pb.ConnectorResource.STATE_CONNECTED
instill_model.test() == connector_pb.Connector.STATE_CONNECTED
# True
```

Expand Down
1 change: 0 additions & 1 deletion instill/clients/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from instill.clients.client import InstillClient, get_client
from instill.clients.connector import ConnectorClient
from instill.clients.mgmt import MgmtClient
from instill.clients.model import ModelClient
from instill.clients.pipeline import PipelineClient
22 changes: 1 addition & 21 deletions instill/clients/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# pylint: disable=no-name-in-module
from instill.clients.connector import ConnectorClient
from instill.clients.mgmt import MgmtClient
from instill.clients.model import ModelClient
from instill.clients.pipeline import PipelineClient
Expand All @@ -22,17 +21,6 @@ def _get_mgmt_client() -> MgmtClient:
return _mgmt_client


def _get_connector_client() -> ConnectorClient:
global _connector_client

if _connector_client is None:
_connector_client = ConnectorClient(
namespace=_get_mgmt_client().get_user().name
)

return _connector_client


def _get_pipeline_client() -> PipelineClient:
global _pipeline_client

Expand All @@ -57,12 +45,8 @@ def __init__(self) -> None:
if not self.mgmt_service.is_serving():
Logger.w("Instill Core is required")
raise NotServingException
self.connector_service = _get_connector_client()
self.pipeline_service = _get_pipeline_client()
if (
not self.connector_service.is_serving()
and not self.pipeline_service.is_serving()
):
if not self.pipeline_service.is_serving():
Logger.w("Instill VDP is not serving, VDP functionalities will not work")
self.model_service = _get_model_client()
if not self.model_service.is_serving():
Expand All @@ -72,17 +56,13 @@ def __init__(self) -> None:

def set_instance(self, instance: str):
self.mgmt_service.instance = instance
self.connector_service.instance = instance
self.pipeline_service.instance = instance
self.model_service.instance = instance

def close(self):
if self.mgmt_service.is_serving():
for host in self.mgmt_service.hosts.values():
host["channel"].close()
if self.connector_service.is_serving():
for host in self.connector_service.hosts.values():
host["channel"].close()
if self.pipeline_service.is_serving():
for host in self.pipeline_service.hosts.values():
host["channel"].close()
Expand Down
199 changes: 0 additions & 199 deletions instill/clients/connector.py

This file was deleted.

Loading

0 comments on commit 8e7cc40

Please sign in to comment.