Skip to content

Commit

Permalink
RSDK-7393 - remove references to do_command from mlmodel service (via…
Browse files Browse the repository at this point in the history
  • Loading branch information
stuqdog authored May 6, 2024
1 parent 7b34a10 commit 96ef235
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
9 changes: 1 addition & 8 deletions src/viam/services/mlmodel/client.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from typing import Dict, Mapping, Optional
from typing import Dict, Optional

from grpclib.client import Channel
from numpy.typing import NDArray

from viam.proto.common import DoCommandRequest, DoCommandResponse
from viam.proto.service.mlmodel import InferRequest, InferResponse, MetadataRequest, MetadataResponse, MLModelServiceStub
from viam.resource.rpc_client_base import ReconfigurableResourceRPCClientBase
from viam.services.mlmodel.utils import flat_tensors_to_ndarrays, ndarrays_to_flat_tensors
from viam.utils import ValueTypes, dict_to_struct, struct_to_dict

from .mlmodel import Metadata, MLModel

Expand All @@ -27,8 +25,3 @@ async def metadata(self, *, timeout: Optional[float] = None) -> Metadata:
request = MetadataRequest(name=self.name)
response: MetadataResponse = await self.client.Metadata(request)
return response.metadata

async def do_command(self, command: Mapping[str, ValueTypes], *, timeout: Optional[float] = None, **kwargs) -> Mapping[str, ValueTypes]:
request = DoCommandRequest(name=self.name, command=dict_to_struct(command))
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout)
return struct_to_dict(response.result)
6 changes: 0 additions & 6 deletions tests/test_mlmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ async def test_metadata(self):
resp = await self.mlmodel.metadata()
assert resp == MockMLModel.META

@pytest.mark.asyncio
async def do_command(self):
command = {"command": "args"}
resp = await self.mlmodel.do_command(command)
assert resp == {"command": command}


class TestService:
@classmethod
Expand Down

0 comments on commit 96ef235

Please sign in to comment.