Skip to content

Commit

Permalink
undo uv.lock changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stuqdog committed Jan 28, 2025
1 parent 2e6f012 commit 01058e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
12 changes: 1 addition & 11 deletions docs/examples/_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
from grpclib.server import Server, Stream
from grpclib.utils import graceful_exit

from viam.proto.robot import (
UnimplementedRobotServiceBase,
GetMachineStatusRequest,
GetMachineStatusResponse
)
from viam.app.data_client import DataClient
from viam.proto.app import (
AddRoleRequest,
Expand Down Expand Up @@ -600,13 +595,8 @@ async def GetRegistryItem(self, stream: Stream[GetRegistryItemRequest, GetRegist
raise NotImplementedError()


class MockRobot(UnimplementedRobotServiceBase):
async def GetMachineStatus(self, stream: Stream[GetMachineStatusRequest, GetMachineStatusResponse]) -> None:
await stream.send_message(GetMachineStatusResponse(state: GetMachineStatusResponse.STATE_RUNNING))


async def main(*, host: str = "127.0.0.1", port: int = 9092) -> None:
server = Server([MockData(), MockDataSync(), MockApp(), MockRobot()])
server = Server([MockData(), MockDataSync(), MockApp()])
with graceful_exit([server]):
await server.start(host, port)
await server.wait_closed()
Expand Down
7 changes: 7 additions & 0 deletions src/viam/robot/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from viam.errors import ViamGRPCError
from viam.proto.common import ResourceName
from viam.proto.robot import (
GetMachineStatusRequest,
GetMachineStatusResponse,
ResourceNamesRequest,
ResourceNamesResponse,
StopAllRequest,
Expand All @@ -33,6 +35,11 @@ def _generate_metadata(self) -> List[ResourceName]:

return list(md)

async def GetMachineStatus(self, stream: Stream[GetMachineStatusRequest, GetMachineStatusResponse]) -> None:
request = await stream.recv_message()
assert request is not None
await stream.send_message(GetMachineStatusResponse(state=GetMachineStatusResponse.STATE_RUNNING))

async def ResourceNames(self, stream: Stream[ResourceNamesRequest, ResourceNamesResponse]) -> None:
request = await stream.recv_message()
assert request is not None
Expand Down

0 comments on commit 01058e5

Please sign in to comment.