Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
undo uv.lock changes
Browse files Browse the repository at this point in the history
stuqdog committed Jan 28, 2025
1 parent 2e6f012 commit 01058e5
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
@@ -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,
@@ -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()
7 changes: 7 additions & 0 deletions src/viam/robot/service.py
Original file line number Diff line number Diff line change
@@ -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,
@@ -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

0 comments on commit 01058e5

Please sign in to comment.