viam-sdk 0.46.0__py3-none-linux_armv6l.whl → 0.48.0__py3-none-linux_armv6l.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of viam-sdk might be problematic. Click here for more details.
- viam/app/data_client.py +280 -3
- viam/components/arm/arm.py +1 -1
- viam/components/gripper/__init__.py +2 -0
- viam/components/gripper/client.py +15 -2
- viam/components/gripper/gripper.py +37 -1
- viam/components/gripper/service.py +19 -3
- viam/gen/app/datapipelines/v1/data_pipelines_grpc.py +1 -1
- viam/gen/app/datapipelines/v1/data_pipelines_pb2.py +42 -41
- viam/gen/app/datapipelines/v1/data_pipelines_pb2.pyi +40 -7
- viam/gen/app/mltraining/v1/ml_training_pb2.py +30 -24
- viam/gen/app/mltraining/v1/ml_training_pb2.pyi +21 -2
- viam/gen/app/v1/app_grpc.py +9 -1
- viam/gen/app/v1/app_pb2.py +523 -519
- viam/gen/app/v1/app_pb2.pyi +56 -6
- viam/gen/component/gripper/v1/gripper_grpc.py +10 -2
- viam/gen/component/gripper/v1/gripper_pb2.py +4 -2
- viam/gen/provisioning/v1/provisioning_grpc.py +10 -2
- viam/gen/provisioning/v1/provisioning_pb2.py +29 -25
- viam/gen/provisioning/v1/provisioning_pb2.pyi +20 -2
- viam/module/module.py +67 -7
- viam/proto/app/__init__.py +4 -0
- viam/proto/provisioning/__init__.py +4 -0
- viam/resource/easy_resource.py +4 -4
- viam/resource/registry.py +2 -2
- viam/resource/types.py +2 -2
- viam/rpc/server.py +24 -10
- viam/version_metadata.py +2 -2
- {viam_sdk-0.46.0.dist-info → viam_sdk-0.48.0.dist-info}/METADATA +1 -1
- {viam_sdk-0.46.0.dist-info → viam_sdk-0.48.0.dist-info}/RECORD +31 -31
- {viam_sdk-0.46.0.dist-info → viam_sdk-0.48.0.dist-info}/WHEEL +0 -0
- {viam_sdk-0.46.0.dist-info → viam_sdk-0.48.0.dist-info}/licenses/LICENSE +0 -0
viam/gen/app/v1/app_pb2.pyi
CHANGED
|
@@ -532,12 +532,14 @@ global___GetOrganizationResponse = GetOrganizationResponse
|
|
|
532
532
|
class GetOrganizationNamespaceAvailabilityRequest(google.protobuf.message.Message):
|
|
533
533
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
534
534
|
PUBLIC_NAMESPACE_FIELD_NUMBER: builtins.int
|
|
535
|
+
ORGANIZATION_ID_FIELD_NUMBER: builtins.int
|
|
535
536
|
public_namespace: builtins.str
|
|
537
|
+
organization_id: builtins.str
|
|
536
538
|
|
|
537
|
-
def __init__(self, *, public_namespace: builtins.str=...) -> None:
|
|
539
|
+
def __init__(self, *, public_namespace: builtins.str=..., organization_id: builtins.str=...) -> None:
|
|
538
540
|
...
|
|
539
541
|
|
|
540
|
-
def ClearField(self, field_name: typing.Literal['public_namespace', b'public_namespace']) -> None:
|
|
542
|
+
def ClearField(self, field_name: typing.Literal['organization_id', b'organization_id', 'public_namespace', b'public_namespace']) -> None:
|
|
541
543
|
...
|
|
542
544
|
global___GetOrganizationNamespaceAvailabilityRequest = GetOrganizationNamespaceAvailabilityRequest
|
|
543
545
|
|
|
@@ -886,13 +888,22 @@ class ResendOrganizationInviteRequest(google.protobuf.message.Message):
|
|
|
886
888
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
887
889
|
ORGANIZATION_ID_FIELD_NUMBER: builtins.int
|
|
888
890
|
EMAIL_FIELD_NUMBER: builtins.int
|
|
891
|
+
SEND_EMAIL_INVITE_FIELD_NUMBER: builtins.int
|
|
889
892
|
organization_id: builtins.str
|
|
890
893
|
email: builtins.str
|
|
894
|
+
send_email_invite: builtins.bool
|
|
895
|
+
'Set to true (the default) to send an email to the recipient of an invite. The user must accept the email to be added to the associated authorizations.\n When set to false, the user automatically receives the associated authorization on the next login of the user with the associated email address.\n '
|
|
891
896
|
|
|
892
|
-
def __init__(self, *, organization_id: builtins.str=..., email: builtins.str=...) -> None:
|
|
897
|
+
def __init__(self, *, organization_id: builtins.str=..., email: builtins.str=..., send_email_invite: builtins.bool | None=...) -> None:
|
|
893
898
|
...
|
|
894
899
|
|
|
895
|
-
def
|
|
900
|
+
def HasField(self, field_name: typing.Literal['_send_email_invite', b'_send_email_invite', 'send_email_invite', b'send_email_invite']) -> builtins.bool:
|
|
901
|
+
...
|
|
902
|
+
|
|
903
|
+
def ClearField(self, field_name: typing.Literal['_send_email_invite', b'_send_email_invite', 'email', b'email', 'organization_id', b'organization_id', 'send_email_invite', b'send_email_invite']) -> None:
|
|
904
|
+
...
|
|
905
|
+
|
|
906
|
+
def WhichOneof(self, oneof_group: typing.Literal['_send_email_invite', b'_send_email_invite']) -> typing.Literal['send_email_invite'] | None:
|
|
896
907
|
...
|
|
897
908
|
global___ResendOrganizationInviteRequest = ResendOrganizationInviteRequest
|
|
898
909
|
|
|
@@ -1869,6 +1880,40 @@ class GetRobotPartResponse(google.protobuf.message.Message):
|
|
|
1869
1880
|
...
|
|
1870
1881
|
global___GetRobotPartResponse = GetRobotPartResponse
|
|
1871
1882
|
|
|
1883
|
+
@typing.final
|
|
1884
|
+
class GetRobotPartByNameAndLocationRequest(google.protobuf.message.Message):
|
|
1885
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
1886
|
+
NAME_FIELD_NUMBER: builtins.int
|
|
1887
|
+
LOCATION_ID_FIELD_NUMBER: builtins.int
|
|
1888
|
+
name: builtins.str
|
|
1889
|
+
location_id: builtins.str
|
|
1890
|
+
|
|
1891
|
+
def __init__(self, *, name: builtins.str=..., location_id: builtins.str=...) -> None:
|
|
1892
|
+
...
|
|
1893
|
+
|
|
1894
|
+
def ClearField(self, field_name: typing.Literal['location_id', b'location_id', 'name', b'name']) -> None:
|
|
1895
|
+
...
|
|
1896
|
+
global___GetRobotPartByNameAndLocationRequest = GetRobotPartByNameAndLocationRequest
|
|
1897
|
+
|
|
1898
|
+
@typing.final
|
|
1899
|
+
class GetRobotPartByNameAndLocationResponse(google.protobuf.message.Message):
|
|
1900
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
1901
|
+
PART_FIELD_NUMBER: builtins.int
|
|
1902
|
+
|
|
1903
|
+
@property
|
|
1904
|
+
def part(self) -> global___RobotPart:
|
|
1905
|
+
...
|
|
1906
|
+
|
|
1907
|
+
def __init__(self, *, part: global___RobotPart | None=...) -> None:
|
|
1908
|
+
...
|
|
1909
|
+
|
|
1910
|
+
def HasField(self, field_name: typing.Literal['part', b'part']) -> builtins.bool:
|
|
1911
|
+
...
|
|
1912
|
+
|
|
1913
|
+
def ClearField(self, field_name: typing.Literal['part', b'part']) -> None:
|
|
1914
|
+
...
|
|
1915
|
+
global___GetRobotPartByNameAndLocationResponse = GetRobotPartByNameAndLocationResponse
|
|
1916
|
+
|
|
1872
1917
|
@typing.final
|
|
1873
1918
|
class GetRobotPartLogsRequest(google.protobuf.message.Message):
|
|
1874
1919
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
@@ -2935,12 +2980,17 @@ global___ListMachineFragmentsResponse = ListMachineFragmentsResponse
|
|
|
2935
2980
|
class ListMachineSummariesRequest(google.protobuf.message.Message):
|
|
2936
2981
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
2937
2982
|
ORGANIZATION_ID_FIELD_NUMBER: builtins.int
|
|
2983
|
+
FRAGMENT_IDS_FIELD_NUMBER: builtins.int
|
|
2938
2984
|
organization_id: builtins.str
|
|
2939
2985
|
|
|
2940
|
-
|
|
2986
|
+
@property
|
|
2987
|
+
def fragment_ids(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
|
|
2988
|
+
"""Optional list of fragment IDs to filter machines that use any of these fragments"""
|
|
2989
|
+
|
|
2990
|
+
def __init__(self, *, organization_id: builtins.str=..., fragment_ids: collections.abc.Iterable[builtins.str] | None=...) -> None:
|
|
2941
2991
|
...
|
|
2942
2992
|
|
|
2943
|
-
def ClearField(self, field_name: typing.Literal['organization_id', b'organization_id']) -> None:
|
|
2993
|
+
def ClearField(self, field_name: typing.Literal['fragment_ids', b'fragment_ids', 'organization_id', b'organization_id']) -> None:
|
|
2944
2994
|
...
|
|
2945
2995
|
global___ListMachineSummariesRequest = ListMachineSummariesRequest
|
|
2946
2996
|
|
|
@@ -36,8 +36,12 @@ class GripperServiceBase(abc.ABC):
|
|
|
36
36
|
async def GetGeometries(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse]') -> None:
|
|
37
37
|
pass
|
|
38
38
|
|
|
39
|
+
@abc.abstractmethod
|
|
40
|
+
async def GetKinematics(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetKinematicsRequest, common.v1.common_pb2.GetKinematicsResponse]') -> None:
|
|
41
|
+
pass
|
|
42
|
+
|
|
39
43
|
def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
|
|
40
|
-
return {'/viam.component.gripper.v1.GripperService/Open': grpclib.const.Handler(self.Open, grpclib.const.Cardinality.UNARY_UNARY, component.gripper.v1.gripper_pb2.OpenRequest, component.gripper.v1.gripper_pb2.OpenResponse), '/viam.component.gripper.v1.GripperService/Grab': grpclib.const.Handler(self.Grab, grpclib.const.Cardinality.UNARY_UNARY, component.gripper.v1.gripper_pb2.GrabRequest, component.gripper.v1.gripper_pb2.GrabResponse), '/viam.component.gripper.v1.GripperService/Stop': grpclib.const.Handler(self.Stop, grpclib.const.Cardinality.UNARY_UNARY, component.gripper.v1.gripper_pb2.StopRequest, component.gripper.v1.gripper_pb2.StopResponse), '/viam.component.gripper.v1.GripperService/IsMoving': grpclib.const.Handler(self.IsMoving, grpclib.const.Cardinality.UNARY_UNARY, component.gripper.v1.gripper_pb2.IsMovingRequest, component.gripper.v1.gripper_pb2.IsMovingResponse), '/viam.component.gripper.v1.GripperService/DoCommand': grpclib.const.Handler(self.DoCommand, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse), '/viam.component.gripper.v1.GripperService/GetGeometries': grpclib.const.Handler(self.GetGeometries, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse)}
|
|
44
|
+
return {'/viam.component.gripper.v1.GripperService/Open': grpclib.const.Handler(self.Open, grpclib.const.Cardinality.UNARY_UNARY, component.gripper.v1.gripper_pb2.OpenRequest, component.gripper.v1.gripper_pb2.OpenResponse), '/viam.component.gripper.v1.GripperService/Grab': grpclib.const.Handler(self.Grab, grpclib.const.Cardinality.UNARY_UNARY, component.gripper.v1.gripper_pb2.GrabRequest, component.gripper.v1.gripper_pb2.GrabResponse), '/viam.component.gripper.v1.GripperService/Stop': grpclib.const.Handler(self.Stop, grpclib.const.Cardinality.UNARY_UNARY, component.gripper.v1.gripper_pb2.StopRequest, component.gripper.v1.gripper_pb2.StopResponse), '/viam.component.gripper.v1.GripperService/IsMoving': grpclib.const.Handler(self.IsMoving, grpclib.const.Cardinality.UNARY_UNARY, component.gripper.v1.gripper_pb2.IsMovingRequest, component.gripper.v1.gripper_pb2.IsMovingResponse), '/viam.component.gripper.v1.GripperService/DoCommand': grpclib.const.Handler(self.DoCommand, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse), '/viam.component.gripper.v1.GripperService/GetGeometries': grpclib.const.Handler(self.GetGeometries, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse), '/viam.component.gripper.v1.GripperService/GetKinematics': grpclib.const.Handler(self.GetKinematics, grpclib.const.Cardinality.UNARY_UNARY, common.v1.common_pb2.GetKinematicsRequest, common.v1.common_pb2.GetKinematicsResponse)}
|
|
41
45
|
|
|
42
46
|
class UnimplementedGripperServiceBase(GripperServiceBase):
|
|
43
47
|
|
|
@@ -59,6 +63,9 @@ class UnimplementedGripperServiceBase(GripperServiceBase):
|
|
|
59
63
|
async def GetGeometries(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse]') -> None:
|
|
60
64
|
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
|
|
61
65
|
|
|
66
|
+
async def GetKinematics(self, stream: 'grpclib.server.Stream[common.v1.common_pb2.GetKinematicsRequest, common.v1.common_pb2.GetKinematicsResponse]') -> None:
|
|
67
|
+
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
|
|
68
|
+
|
|
62
69
|
class GripperServiceStub:
|
|
63
70
|
|
|
64
71
|
def __init__(self, channel: grpclib.client.Channel) -> None:
|
|
@@ -67,4 +74,5 @@ class GripperServiceStub:
|
|
|
67
74
|
self.Stop = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.gripper.v1.GripperService/Stop', component.gripper.v1.gripper_pb2.StopRequest, component.gripper.v1.gripper_pb2.StopResponse)
|
|
68
75
|
self.IsMoving = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.gripper.v1.GripperService/IsMoving', component.gripper.v1.gripper_pb2.IsMovingRequest, component.gripper.v1.gripper_pb2.IsMovingResponse)
|
|
69
76
|
self.DoCommand = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.gripper.v1.GripperService/DoCommand', common.v1.common_pb2.DoCommandRequest, common.v1.common_pb2.DoCommandResponse)
|
|
70
|
-
self.GetGeometries = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.gripper.v1.GripperService/GetGeometries', common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse)
|
|
77
|
+
self.GetGeometries = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.gripper.v1.GripperService/GetGeometries', common.v1.common_pb2.GetGeometriesRequest, common.v1.common_pb2.GetGeometriesResponse)
|
|
78
|
+
self.GetKinematics = grpclib.client.UnaryUnaryMethod(channel, '/viam.component.gripper.v1.GripperService/GetKinematics', common.v1.common_pb2.GetKinematicsRequest, common.v1.common_pb2.GetKinematicsResponse)
|
|
@@ -9,7 +9,7 @@ _sym_db = _symbol_database.Default()
|
|
|
9
9
|
from ....common.v1 import common_pb2 as common_dot_v1_dot_common__pb2
|
|
10
10
|
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
|
|
11
11
|
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
|
12
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n"component/gripper/v1/gripper.proto\x12\x19viam.component.gripper.v1\x1a\x16common/v1/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1cgoogle/protobuf/struct.proto"P\n\x0bOpenRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12-\n\x05extra\x18c \x01(\x0b2\x17.google.protobuf.StructR\x05extra"\x0e\n\x0cOpenResponse"P\n\x0bGrabRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12-\n\x05extra\x18c \x01(\x0b2\x17.google.protobuf.StructR\x05extra"W\n\x0cGrabResponse\x12\x18\n\x07success\x18\x01 \x01(\x08R\x07success\x12-\n\x05extra\x18c \x01(\x0b2\x17.google.protobuf.StructR\x05extra"P\n\x0bStopRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12-\n\x05extra\x18c \x01(\x0b2\x17.google.protobuf.StructR\x05extra"\x0e\n\x0cStopResponse"%\n\x0fIsMovingRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name"/\n\x10IsMovingResponse\x12\x1b\n\tis_moving\x18\x01 \x01(\x08R\x08isMoving2\
|
|
12
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n"component/gripper/v1/gripper.proto\x12\x19viam.component.gripper.v1\x1a\x16common/v1/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1cgoogle/protobuf/struct.proto"P\n\x0bOpenRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12-\n\x05extra\x18c \x01(\x0b2\x17.google.protobuf.StructR\x05extra"\x0e\n\x0cOpenResponse"P\n\x0bGrabRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12-\n\x05extra\x18c \x01(\x0b2\x17.google.protobuf.StructR\x05extra"W\n\x0cGrabResponse\x12\x18\n\x07success\x18\x01 \x01(\x08R\x07success\x12-\n\x05extra\x18c \x01(\x0b2\x17.google.protobuf.StructR\x05extra"P\n\x0bStopRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12-\n\x05extra\x18c \x01(\x0b2\x17.google.protobuf.StructR\x05extra"\x0e\n\x0cStopResponse"%\n\x0fIsMovingRequest\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name"/\n\x10IsMovingResponse\x12\x1b\n\tis_moving\x18\x01 \x01(\x08R\x08isMoving2\xa0\x08\n\x0eGripperService\x12\x8f\x01\n\x04Open\x12&.viam.component.gripper.v1.OpenRequest\x1a\'.viam.component.gripper.v1.OpenResponse"6\xa0\x92)\x01\x82\xd3\xe4\x93\x02,\x1a*/viam/api/v1/component/gripper/{name}/open\x12\x8f\x01\n\x04Grab\x12&.viam.component.gripper.v1.GrabRequest\x1a\'.viam.component.gripper.v1.GrabResponse"6\xa0\x92)\x01\x82\xd3\xe4\x93\x02,\x1a*/viam/api/v1/component/gripper/{name}/grab\x12\x8b\x01\n\x04Stop\x12&.viam.component.gripper.v1.StopRequest\x1a\'.viam.component.gripper.v1.StopResponse"2\x82\xd3\xe4\x93\x02,"*/viam/api/v1/component/gripper/{name}/stop\x12\x9c\x01\n\x08IsMoving\x12*.viam.component.gripper.v1.IsMovingRequest\x1a+.viam.component.gripper.v1.IsMovingResponse"7\x82\xd3\xe4\x93\x021\x12//viam/api/v1/component/gripper/{name}/is_moving\x12\x8a\x01\n\tDoCommand\x12 .viam.common.v1.DoCommandRequest\x1a!.viam.common.v1.DoCommandResponse"8\x82\xd3\xe4\x93\x022"0/viam/api/v1/component/gripper/{name}/do_command\x12\x96\x01\n\rGetGeometries\x12$.viam.common.v1.GetGeometriesRequest\x1a%.viam.common.v1.GetGeometriesResponse"8\x82\xd3\xe4\x93\x022\x120/viam/api/v1/component/gripper/{name}/geometries\x12\x96\x01\n\rGetKinematics\x12$.viam.common.v1.GetKinematicsRequest\x1a%.viam.common.v1.GetKinematicsResponse"8\x82\xd3\xe4\x93\x022\x120/viam/api/v1/component/gripper/{name}/kinematicsBE\n\x1dcom.viam.component.gripper.v1Z$go.viam.com/api/component/gripper/v1b\x06proto3')
|
|
13
13
|
_globals = globals()
|
|
14
14
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
15
15
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'component.gripper.v1.gripper_pb2', _globals)
|
|
@@ -28,6 +28,8 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
28
28
|
_globals['_GRIPPERSERVICE'].methods_by_name['DoCommand']._serialized_options = b'\x82\xd3\xe4\x93\x022"0/viam/api/v1/component/gripper/{name}/do_command'
|
|
29
29
|
_globals['_GRIPPERSERVICE'].methods_by_name['GetGeometries']._loaded_options = None
|
|
30
30
|
_globals['_GRIPPERSERVICE'].methods_by_name['GetGeometries']._serialized_options = b'\x82\xd3\xe4\x93\x022\x120/viam/api/v1/component/gripper/{name}/geometries'
|
|
31
|
+
_globals['_GRIPPERSERVICE'].methods_by_name['GetKinematics']._loaded_options = None
|
|
32
|
+
_globals['_GRIPPERSERVICE'].methods_by_name['GetKinematics']._serialized_options = b'\x82\xd3\xe4\x93\x022\x120/viam/api/v1/component/gripper/{name}/kinematics'
|
|
31
33
|
_globals['_OPENREQUEST']._serialized_start = 149
|
|
32
34
|
_globals['_OPENREQUEST']._serialized_end = 229
|
|
33
35
|
_globals['_OPENRESPONSE']._serialized_start = 231
|
|
@@ -45,4 +47,4 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
45
47
|
_globals['_ISMOVINGRESPONSE']._serialized_start = 555
|
|
46
48
|
_globals['_ISMOVINGRESPONSE']._serialized_end = 602
|
|
47
49
|
_globals['_GRIPPERSERVICE']._serialized_start = 605
|
|
48
|
-
_globals['_GRIPPERSERVICE']._serialized_end =
|
|
50
|
+
_globals['_GRIPPERSERVICE']._serialized_end = 1661
|
|
@@ -25,8 +25,12 @@ class ProvisioningServiceBase(abc.ABC):
|
|
|
25
25
|
async def GetNetworkList(self, stream: 'grpclib.server.Stream[provisioning.v1.provisioning_pb2.GetNetworkListRequest, provisioning.v1.provisioning_pb2.GetNetworkListResponse]') -> None:
|
|
26
26
|
pass
|
|
27
27
|
|
|
28
|
+
@abc.abstractmethod
|
|
29
|
+
async def ExitProvisioning(self, stream: 'grpclib.server.Stream[provisioning.v1.provisioning_pb2.ExitProvisioningRequest, provisioning.v1.provisioning_pb2.ExitProvisioningResponse]') -> None:
|
|
30
|
+
pass
|
|
31
|
+
|
|
28
32
|
def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
|
|
29
|
-
return {'/viam.provisioning.v1.ProvisioningService/GetSmartMachineStatus': grpclib.const.Handler(self.GetSmartMachineStatus, grpclib.const.Cardinality.UNARY_UNARY, provisioning.v1.provisioning_pb2.GetSmartMachineStatusRequest, provisioning.v1.provisioning_pb2.GetSmartMachineStatusResponse), '/viam.provisioning.v1.ProvisioningService/SetNetworkCredentials': grpclib.const.Handler(self.SetNetworkCredentials, grpclib.const.Cardinality.UNARY_UNARY, provisioning.v1.provisioning_pb2.SetNetworkCredentialsRequest, provisioning.v1.provisioning_pb2.SetNetworkCredentialsResponse), '/viam.provisioning.v1.ProvisioningService/SetSmartMachineCredentials': grpclib.const.Handler(self.SetSmartMachineCredentials, grpclib.const.Cardinality.UNARY_UNARY, provisioning.v1.provisioning_pb2.SetSmartMachineCredentialsRequest, provisioning.v1.provisioning_pb2.SetSmartMachineCredentialsResponse), '/viam.provisioning.v1.ProvisioningService/GetNetworkList': grpclib.const.Handler(self.GetNetworkList, grpclib.const.Cardinality.UNARY_UNARY, provisioning.v1.provisioning_pb2.GetNetworkListRequest, provisioning.v1.provisioning_pb2.GetNetworkListResponse)}
|
|
33
|
+
return {'/viam.provisioning.v1.ProvisioningService/GetSmartMachineStatus': grpclib.const.Handler(self.GetSmartMachineStatus, grpclib.const.Cardinality.UNARY_UNARY, provisioning.v1.provisioning_pb2.GetSmartMachineStatusRequest, provisioning.v1.provisioning_pb2.GetSmartMachineStatusResponse), '/viam.provisioning.v1.ProvisioningService/SetNetworkCredentials': grpclib.const.Handler(self.SetNetworkCredentials, grpclib.const.Cardinality.UNARY_UNARY, provisioning.v1.provisioning_pb2.SetNetworkCredentialsRequest, provisioning.v1.provisioning_pb2.SetNetworkCredentialsResponse), '/viam.provisioning.v1.ProvisioningService/SetSmartMachineCredentials': grpclib.const.Handler(self.SetSmartMachineCredentials, grpclib.const.Cardinality.UNARY_UNARY, provisioning.v1.provisioning_pb2.SetSmartMachineCredentialsRequest, provisioning.v1.provisioning_pb2.SetSmartMachineCredentialsResponse), '/viam.provisioning.v1.ProvisioningService/GetNetworkList': grpclib.const.Handler(self.GetNetworkList, grpclib.const.Cardinality.UNARY_UNARY, provisioning.v1.provisioning_pb2.GetNetworkListRequest, provisioning.v1.provisioning_pb2.GetNetworkListResponse), '/viam.provisioning.v1.ProvisioningService/ExitProvisioning': grpclib.const.Handler(self.ExitProvisioning, grpclib.const.Cardinality.UNARY_UNARY, provisioning.v1.provisioning_pb2.ExitProvisioningRequest, provisioning.v1.provisioning_pb2.ExitProvisioningResponse)}
|
|
30
34
|
|
|
31
35
|
class UnimplementedProvisioningServiceBase(ProvisioningServiceBase):
|
|
32
36
|
|
|
@@ -42,10 +46,14 @@ class UnimplementedProvisioningServiceBase(ProvisioningServiceBase):
|
|
|
42
46
|
async def GetNetworkList(self, stream: 'grpclib.server.Stream[provisioning.v1.provisioning_pb2.GetNetworkListRequest, provisioning.v1.provisioning_pb2.GetNetworkListResponse]') -> None:
|
|
43
47
|
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
|
|
44
48
|
|
|
49
|
+
async def ExitProvisioning(self, stream: 'grpclib.server.Stream[provisioning.v1.provisioning_pb2.ExitProvisioningRequest, provisioning.v1.provisioning_pb2.ExitProvisioningResponse]') -> None:
|
|
50
|
+
raise grpclib.exceptions.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
|
|
51
|
+
|
|
45
52
|
class ProvisioningServiceStub:
|
|
46
53
|
|
|
47
54
|
def __init__(self, channel: grpclib.client.Channel) -> None:
|
|
48
55
|
self.GetSmartMachineStatus = grpclib.client.UnaryUnaryMethod(channel, '/viam.provisioning.v1.ProvisioningService/GetSmartMachineStatus', provisioning.v1.provisioning_pb2.GetSmartMachineStatusRequest, provisioning.v1.provisioning_pb2.GetSmartMachineStatusResponse)
|
|
49
56
|
self.SetNetworkCredentials = grpclib.client.UnaryUnaryMethod(channel, '/viam.provisioning.v1.ProvisioningService/SetNetworkCredentials', provisioning.v1.provisioning_pb2.SetNetworkCredentialsRequest, provisioning.v1.provisioning_pb2.SetNetworkCredentialsResponse)
|
|
50
57
|
self.SetSmartMachineCredentials = grpclib.client.UnaryUnaryMethod(channel, '/viam.provisioning.v1.ProvisioningService/SetSmartMachineCredentials', provisioning.v1.provisioning_pb2.SetSmartMachineCredentialsRequest, provisioning.v1.provisioning_pb2.SetSmartMachineCredentialsResponse)
|
|
51
|
-
self.GetNetworkList = grpclib.client.UnaryUnaryMethod(channel, '/viam.provisioning.v1.ProvisioningService/GetNetworkList', provisioning.v1.provisioning_pb2.GetNetworkListRequest, provisioning.v1.provisioning_pb2.GetNetworkListResponse)
|
|
58
|
+
self.GetNetworkList = grpclib.client.UnaryUnaryMethod(channel, '/viam.provisioning.v1.ProvisioningService/GetNetworkList', provisioning.v1.provisioning_pb2.GetNetworkListRequest, provisioning.v1.provisioning_pb2.GetNetworkListResponse)
|
|
59
|
+
self.ExitProvisioning = grpclib.client.UnaryUnaryMethod(channel, '/viam.provisioning.v1.ProvisioningService/ExitProvisioning', provisioning.v1.provisioning_pb2.ExitProvisioningRequest, provisioning.v1.provisioning_pb2.ExitProvisioningResponse)
|
|
@@ -6,34 +6,38 @@ from google.protobuf import symbol_database as _symbol_database
|
|
|
6
6
|
from google.protobuf.internal import builder as _builder
|
|
7
7
|
_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 5, 29, 2, '', 'provisioning/v1/provisioning.proto')
|
|
8
8
|
_sym_db = _symbol_database.Default()
|
|
9
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n"provisioning/v1/provisioning.proto\x12\x14viam.provisioning.v1"\x1e\n\x1cGetSmartMachineStatusRequest"\
|
|
9
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n"provisioning/v1/provisioning.proto\x12\x14viam.provisioning.v1"\x19\n\x17ExitProvisioningRequest"\x1a\n\x18ExitProvisioningResponse"\x1e\n\x1cGetSmartMachineStatusRequest"\xf0\x02\n\x1dGetSmartMachineStatusResponse\x12S\n\x11provisioning_info\x18\x01 \x01(\x0b2&.viam.provisioning.v1.ProvisioningInfoR\x10provisioningInfo\x12A\n\x1dhas_smart_machine_credentials\x18\x02 \x01(\x08R\x1ahasSmartMachineCredentials\x12\x1b\n\tis_online\x18\x03 \x01(\x08R\x08isOnline\x12]\n\x19latest_connection_attempt\x18\x04 \x01(\x0b2!.viam.provisioning.v1.NetworkInfoR\x17latestConnectionAttempt\x12\x16\n\x06errors\x18\x05 \x03(\tR\x06errors\x12#\n\ragent_version\x18\x06 \x01(\tR\x0cagentVersion"X\n\x1cSetNetworkCredentialsRequest\x12\x12\n\x04type\x18\x01 \x01(\tR\x04type\x12\x12\n\x04ssid\x18\x02 \x01(\tR\x04ssid\x12\x10\n\x03psk\x18\x03 \x01(\tR\x03psk"\x1f\n\x1dSetNetworkCredentialsResponse"\\\n!SetSmartMachineCredentialsRequest\x127\n\x05cloud\x18\x01 \x01(\x0b2!.viam.provisioning.v1.CloudConfigR\x05cloud"$\n"SetSmartMachineCredentialsResponse"\x17\n\x15GetNetworkListRequest"W\n\x16GetNetworkListResponse\x12=\n\x08networks\x18\x01 \x03(\x0b2!.viam.provisioning.v1.NetworkInfoR\x08networks"m\n\x10ProvisioningInfo\x12\x1f\n\x0bfragment_id\x18\x01 \x01(\tR\nfragmentId\x12\x14\n\x05model\x18\x02 \x01(\tR\x05model\x12"\n\x0cmanufacturer\x18\x03 \x01(\tR\x0cmanufacturer"\xa6\x01\n\x0bNetworkInfo\x12\x12\n\x04type\x18\x01 \x01(\tR\x04type\x12\x12\n\x04ssid\x18\x02 \x01(\tR\x04ssid\x12\x1a\n\x08security\x18\x03 \x01(\tR\x08security\x12\x16\n\x06signal\x18\x04 \x01(\x05R\x06signal\x12\x1c\n\tconnected\x18\x05 \x01(\x08R\tconnected\x12\x1d\n\nlast_error\x18\x06 \x01(\tR\tlastError"V\n\x0bCloudConfig\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n\x06secret\x18\x02 \x01(\tR\x06secret\x12\x1f\n\x0bapp_address\x18\x03 \x01(\tR\nappAddress2\x8d\x05\n\x13ProvisioningService\x12\x80\x01\n\x15GetSmartMachineStatus\x122.viam.provisioning.v1.GetSmartMachineStatusRequest\x1a3.viam.provisioning.v1.GetSmartMachineStatusResponse\x12\x80\x01\n\x15SetNetworkCredentials\x122.viam.provisioning.v1.SetNetworkCredentialsRequest\x1a3.viam.provisioning.v1.SetNetworkCredentialsResponse\x12\x8f\x01\n\x1aSetSmartMachineCredentials\x127.viam.provisioning.v1.SetSmartMachineCredentialsRequest\x1a8.viam.provisioning.v1.SetSmartMachineCredentialsResponse\x12k\n\x0eGetNetworkList\x12+.viam.provisioning.v1.GetNetworkListRequest\x1a,.viam.provisioning.v1.GetNetworkListResponse\x12q\n\x10ExitProvisioning\x12-.viam.provisioning.v1.ExitProvisioningRequest\x1a..viam.provisioning.v1.ExitProvisioningResponseB!Z\x1fgo.viam.com/api/provisioning/v1b\x06proto3')
|
|
10
10
|
_globals = globals()
|
|
11
11
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
12
12
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'provisioning.v1.provisioning_pb2', _globals)
|
|
13
13
|
if not _descriptor._USE_C_DESCRIPTORS:
|
|
14
14
|
_globals['DESCRIPTOR']._loaded_options = None
|
|
15
15
|
_globals['DESCRIPTOR']._serialized_options = b'Z\x1fgo.viam.com/api/provisioning/v1'
|
|
16
|
-
_globals['
|
|
17
|
-
_globals['
|
|
18
|
-
_globals['
|
|
19
|
-
_globals['
|
|
20
|
-
_globals['
|
|
21
|
-
_globals['
|
|
22
|
-
_globals['
|
|
23
|
-
_globals['
|
|
24
|
-
_globals['
|
|
25
|
-
_globals['
|
|
26
|
-
_globals['
|
|
27
|
-
_globals['
|
|
28
|
-
_globals['
|
|
29
|
-
_globals['
|
|
30
|
-
_globals['
|
|
31
|
-
_globals['
|
|
32
|
-
_globals['
|
|
33
|
-
_globals['
|
|
34
|
-
_globals['
|
|
35
|
-
_globals['
|
|
36
|
-
_globals['
|
|
37
|
-
_globals['
|
|
38
|
-
_globals['
|
|
39
|
-
_globals['
|
|
16
|
+
_globals['_EXITPROVISIONINGREQUEST']._serialized_start = 60
|
|
17
|
+
_globals['_EXITPROVISIONINGREQUEST']._serialized_end = 85
|
|
18
|
+
_globals['_EXITPROVISIONINGRESPONSE']._serialized_start = 87
|
|
19
|
+
_globals['_EXITPROVISIONINGRESPONSE']._serialized_end = 113
|
|
20
|
+
_globals['_GETSMARTMACHINESTATUSREQUEST']._serialized_start = 115
|
|
21
|
+
_globals['_GETSMARTMACHINESTATUSREQUEST']._serialized_end = 145
|
|
22
|
+
_globals['_GETSMARTMACHINESTATUSRESPONSE']._serialized_start = 148
|
|
23
|
+
_globals['_GETSMARTMACHINESTATUSRESPONSE']._serialized_end = 516
|
|
24
|
+
_globals['_SETNETWORKCREDENTIALSREQUEST']._serialized_start = 518
|
|
25
|
+
_globals['_SETNETWORKCREDENTIALSREQUEST']._serialized_end = 606
|
|
26
|
+
_globals['_SETNETWORKCREDENTIALSRESPONSE']._serialized_start = 608
|
|
27
|
+
_globals['_SETNETWORKCREDENTIALSRESPONSE']._serialized_end = 639
|
|
28
|
+
_globals['_SETSMARTMACHINECREDENTIALSREQUEST']._serialized_start = 641
|
|
29
|
+
_globals['_SETSMARTMACHINECREDENTIALSREQUEST']._serialized_end = 733
|
|
30
|
+
_globals['_SETSMARTMACHINECREDENTIALSRESPONSE']._serialized_start = 735
|
|
31
|
+
_globals['_SETSMARTMACHINECREDENTIALSRESPONSE']._serialized_end = 771
|
|
32
|
+
_globals['_GETNETWORKLISTREQUEST']._serialized_start = 773
|
|
33
|
+
_globals['_GETNETWORKLISTREQUEST']._serialized_end = 796
|
|
34
|
+
_globals['_GETNETWORKLISTRESPONSE']._serialized_start = 798
|
|
35
|
+
_globals['_GETNETWORKLISTRESPONSE']._serialized_end = 885
|
|
36
|
+
_globals['_PROVISIONINGINFO']._serialized_start = 887
|
|
37
|
+
_globals['_PROVISIONINGINFO']._serialized_end = 996
|
|
38
|
+
_globals['_NETWORKINFO']._serialized_start = 999
|
|
39
|
+
_globals['_NETWORKINFO']._serialized_end = 1165
|
|
40
|
+
_globals['_CLOUDCONFIG']._serialized_start = 1167
|
|
41
|
+
_globals['_CLOUDCONFIG']._serialized_end = 1253
|
|
42
|
+
_globals['_PROVISIONINGSERVICE']._serialized_start = 1256
|
|
43
|
+
_globals['_PROVISIONINGSERVICE']._serialized_end = 1909
|
|
@@ -10,6 +10,22 @@ import google.protobuf.message
|
|
|
10
10
|
import typing
|
|
11
11
|
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
|
|
12
12
|
|
|
13
|
+
@typing.final
|
|
14
|
+
class ExitProvisioningRequest(google.protobuf.message.Message):
|
|
15
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
16
|
+
|
|
17
|
+
def __init__(self) -> None:
|
|
18
|
+
...
|
|
19
|
+
global___ExitProvisioningRequest = ExitProvisioningRequest
|
|
20
|
+
|
|
21
|
+
@typing.final
|
|
22
|
+
class ExitProvisioningResponse(google.protobuf.message.Message):
|
|
23
|
+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
24
|
+
|
|
25
|
+
def __init__(self) -> None:
|
|
26
|
+
...
|
|
27
|
+
global___ExitProvisioningResponse = ExitProvisioningResponse
|
|
28
|
+
|
|
13
29
|
@typing.final
|
|
14
30
|
class GetSmartMachineStatusRequest(google.protobuf.message.Message):
|
|
15
31
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
@@ -26,8 +42,10 @@ class GetSmartMachineStatusResponse(google.protobuf.message.Message):
|
|
|
26
42
|
IS_ONLINE_FIELD_NUMBER: builtins.int
|
|
27
43
|
LATEST_CONNECTION_ATTEMPT_FIELD_NUMBER: builtins.int
|
|
28
44
|
ERRORS_FIELD_NUMBER: builtins.int
|
|
45
|
+
AGENT_VERSION_FIELD_NUMBER: builtins.int
|
|
29
46
|
has_smart_machine_credentials: builtins.bool
|
|
30
47
|
is_online: builtins.bool
|
|
48
|
+
agent_version: builtins.str
|
|
31
49
|
|
|
32
50
|
@property
|
|
33
51
|
def provisioning_info(self) -> global___ProvisioningInfo:
|
|
@@ -41,13 +59,13 @@ class GetSmartMachineStatusResponse(google.protobuf.message.Message):
|
|
|
41
59
|
def errors(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
|
|
42
60
|
...
|
|
43
61
|
|
|
44
|
-
def __init__(self, *, provisioning_info: global___ProvisioningInfo | None=..., has_smart_machine_credentials: builtins.bool=..., is_online: builtins.bool=..., latest_connection_attempt: global___NetworkInfo | None=..., errors: collections.abc.Iterable[builtins.str] | None=...) -> None:
|
|
62
|
+
def __init__(self, *, provisioning_info: global___ProvisioningInfo | None=..., has_smart_machine_credentials: builtins.bool=..., is_online: builtins.bool=..., latest_connection_attempt: global___NetworkInfo | None=..., errors: collections.abc.Iterable[builtins.str] | None=..., agent_version: builtins.str=...) -> None:
|
|
45
63
|
...
|
|
46
64
|
|
|
47
65
|
def HasField(self, field_name: typing.Literal['latest_connection_attempt', b'latest_connection_attempt', 'provisioning_info', b'provisioning_info']) -> builtins.bool:
|
|
48
66
|
...
|
|
49
67
|
|
|
50
|
-
def ClearField(self, field_name: typing.Literal['errors', b'errors', 'has_smart_machine_credentials', b'has_smart_machine_credentials', 'is_online', b'is_online', 'latest_connection_attempt', b'latest_connection_attempt', 'provisioning_info', b'provisioning_info']) -> None:
|
|
68
|
+
def ClearField(self, field_name: typing.Literal['agent_version', b'agent_version', 'errors', b'errors', 'has_smart_machine_credentials', b'has_smart_machine_credentials', 'is_online', b'is_online', 'latest_connection_attempt', b'latest_connection_attempt', 'provisioning_info', b'provisioning_info']) -> None:
|
|
51
69
|
...
|
|
52
70
|
global___GetSmartMachineStatusResponse = GetSmartMachineStatusResponse
|
|
53
71
|
|
viam/module/module.py
CHANGED
|
@@ -3,6 +3,7 @@ import io
|
|
|
3
3
|
import logging as pylogging
|
|
4
4
|
import os
|
|
5
5
|
import sys
|
|
6
|
+
from collections.abc import Iterable
|
|
6
7
|
from inspect import iscoroutinefunction
|
|
7
8
|
from threading import Lock
|
|
8
9
|
from typing import List, Mapping, Optional, Sequence, Tuple
|
|
@@ -31,9 +32,40 @@ from viam.resource.base import ResourceBase
|
|
|
31
32
|
from viam.resource.registry import Registry
|
|
32
33
|
from viam.resource.types import API, RESOURCE_TYPE_COMPONENT, RESOURCE_TYPE_SERVICE, Model, ResourceName, resource_name_from_string
|
|
33
34
|
from viam.robot.client import RobotClient
|
|
34
|
-
from viam.rpc.dial import DialOptions
|
|
35
|
+
from viam.rpc.dial import DialOptions, _host_port_from_url
|
|
35
36
|
from viam.rpc.server import Server
|
|
36
37
|
|
|
38
|
+
# These imports are required to register build-in resources with the registry
|
|
39
|
+
from ..components.arm import Arm # noqa: F401
|
|
40
|
+
from ..components.audio_input import AudioInput # noqa: F401
|
|
41
|
+
from ..components.base import Base # noqa: F401
|
|
42
|
+
from ..components.board import Board # noqa: F401
|
|
43
|
+
from ..components.button import Button # noqa: F401
|
|
44
|
+
from ..components.camera import Camera # noqa: F401
|
|
45
|
+
from ..components.encoder import Encoder # noqa: F401
|
|
46
|
+
from ..components.gantry import Gantry # noqa: F401
|
|
47
|
+
from ..components.generic import Generic as GenericComponent # noqa: F401
|
|
48
|
+
from ..components.gripper import Gripper # noqa: F401
|
|
49
|
+
from ..components.input import Controller # noqa: F401
|
|
50
|
+
from ..components.motor import Motor # noqa: F401
|
|
51
|
+
from ..components.movement_sensor import MovementSensor # noqa: F401
|
|
52
|
+
from ..components.pose_tracker import PoseTracker # noqa: F401
|
|
53
|
+
from ..components.power_sensor import PowerSensor # noqa: F401
|
|
54
|
+
from ..components.sensor import Sensor # noqa: F401
|
|
55
|
+
from ..components.servo import Servo # noqa: F401
|
|
56
|
+
from ..components.switch import Switch # noqa: F401
|
|
57
|
+
from ..services.discovery import Discovery # noqa: F401
|
|
58
|
+
from ..services.generic import Generic as GenericService # noqa: F401
|
|
59
|
+
from ..services.motion import Motion # noqa: F401
|
|
60
|
+
from ..services.navigation import Navigation # noqa: F401
|
|
61
|
+
from ..services.slam import SLAM # noqa: F401
|
|
62
|
+
from ..services.vision import Vision # noqa: F401
|
|
63
|
+
|
|
64
|
+
try:
|
|
65
|
+
from ..services.mlmodel import MLModel # noqa: F401
|
|
66
|
+
except ImportError:
|
|
67
|
+
pass
|
|
68
|
+
|
|
37
69
|
from .service import ModuleRPCService
|
|
38
70
|
from .types import Reconfigurable, Stoppable
|
|
39
71
|
|
|
@@ -45,7 +77,8 @@ def _parse_module_args() -> argparse.Namespace:
|
|
|
45
77
|
p = argparse.ArgumentParser(description="Start this viam python module")
|
|
46
78
|
p.add_argument("socket_path", help="path where this module will serve a unix socket")
|
|
47
79
|
p.add_argument("--log-level", type=lambda name: pylogging._nameToLevel[name.upper()], default=logging.INFO)
|
|
48
|
-
|
|
80
|
+
p.add_argument("--tcp-mode", action="store_true")
|
|
81
|
+
return p.parse_known_args()[0]
|
|
49
82
|
|
|
50
83
|
|
|
51
84
|
class Module:
|
|
@@ -54,6 +87,7 @@ class Module:
|
|
|
54
87
|
_ready: bool
|
|
55
88
|
_log_level: int
|
|
56
89
|
_lock: Lock
|
|
90
|
+
_tcp_mode: bool
|
|
57
91
|
parent: Optional[RobotClient] = None
|
|
58
92
|
server: Server
|
|
59
93
|
logger: pylogging.Logger
|
|
@@ -72,7 +106,7 @@ class Module:
|
|
|
72
106
|
Module: a new Module instance
|
|
73
107
|
"""
|
|
74
108
|
args = _parse_module_args()
|
|
75
|
-
return cls(args.socket_path, log_level=args.log_level)
|
|
109
|
+
return cls(args.socket_path, log_level=args.log_level, tcp_mode=args.tcp_mode)
|
|
76
110
|
|
|
77
111
|
@classmethod
|
|
78
112
|
async def run_with_models(cls, *models: ResourceBase):
|
|
@@ -104,7 +138,7 @@ class Module:
|
|
|
104
138
|
module.add_model_from_registry(*key.split("/")) # pyright: ignore [reportArgumentType]
|
|
105
139
|
await module.start()
|
|
106
140
|
|
|
107
|
-
def __init__(self, address: str, *, log_level: int = logging.INFO) -> None:
|
|
141
|
+
def __init__(self, address: str, *, log_level: int = logging.INFO, tcp_mode: bool = False) -> None:
|
|
108
142
|
# When a module is launched by viam-server, its stdout is not connected to a tty. In
|
|
109
143
|
# response, python disables line buffering, which prevents `print` statements from being
|
|
110
144
|
# immediately flushed to viam-server. This behavior can be confusing, interfere with
|
|
@@ -115,6 +149,7 @@ class Module:
|
|
|
115
149
|
if isinstance(sys.stderr, io.TextIOWrapper):
|
|
116
150
|
sys.stderr.reconfigure(line_buffering=True)
|
|
117
151
|
self._address = address
|
|
152
|
+
self._tcp_mode = tcp_mode
|
|
118
153
|
self.server = Server(resources=[], module_service=ModuleRPCService(self))
|
|
119
154
|
self._log_level = log_level
|
|
120
155
|
|
|
@@ -160,7 +195,11 @@ class Module:
|
|
|
160
195
|
async def start(self):
|
|
161
196
|
"""Start the module service and gRPC server"""
|
|
162
197
|
try:
|
|
163
|
-
|
|
198
|
+
if self._tcp_mode:
|
|
199
|
+
host, port = _host_port_from_url(self._address)
|
|
200
|
+
await self.server.serve(log_level=self._log_level, host=host, port=port)
|
|
201
|
+
else:
|
|
202
|
+
await self.server.serve(log_level=self._log_level, path=self._address)
|
|
164
203
|
finally:
|
|
165
204
|
await self.stop()
|
|
166
205
|
|
|
@@ -275,7 +314,28 @@ class Module:
|
|
|
275
314
|
model = Model.from_string(config.model)
|
|
276
315
|
validator = Registry.lookup_validator(api, model)
|
|
277
316
|
try:
|
|
278
|
-
|
|
279
|
-
|
|
317
|
+
# backwards compatibility. Support both ([], []) or [] with deprecation warning.
|
|
318
|
+
# If user's validate returns [str], it will be treated as required dependencies only.
|
|
319
|
+
# Incorect formats, e.g. int, will raise ValidationError.
|
|
320
|
+
_validator_return_test = validator(config)
|
|
321
|
+
if not (isinstance(_validator_return_test, tuple) and len(_validator_return_test) == 2):
|
|
322
|
+
msg = f"Your validate function {validator.__name__} did not return \
|
|
323
|
+
type tuple[Sequence[str], Sequence[str]]. Got {_validator_return_test}."
|
|
324
|
+
self.logger.warning(msg)
|
|
325
|
+
if (isinstance(_validator_return_test, Iterable) and not isinstance(_validator_return_test, str)) and all(
|
|
326
|
+
isinstance(e, str)
|
|
327
|
+
for e in _validator_return_test # type: ignore
|
|
328
|
+
):
|
|
329
|
+
self.logger.warning(
|
|
330
|
+
f"Detected deprecated validate function signature. \
|
|
331
|
+
Treating all dependencies {_validator_return_test} as required dependencies. \
|
|
332
|
+
Please update to new signature Tuple[Sequence[str], Sequence[str]] soon."
|
|
333
|
+
)
|
|
334
|
+
return ValidateConfigResponse(dependencies=_validator_return_test)
|
|
335
|
+
else:
|
|
336
|
+
raise ValidationError(msg)
|
|
337
|
+
|
|
338
|
+
dependencies, optional_dependencies = _validator_return_test
|
|
339
|
+
return ValidateConfigResponse(dependencies=dependencies, optional_dependencies=optional_dependencies)
|
|
280
340
|
except Exception as e:
|
|
281
341
|
raise ValidationError(f"{type(Exception)}: {e}").grpc_error
|
viam/proto/app/__init__.py
CHANGED
|
@@ -119,6 +119,8 @@ from ...gen.app.v1.app_pb2 import (
|
|
|
119
119
|
GetRobotAPIKeysResponse,
|
|
120
120
|
GetRobotMetadataRequest,
|
|
121
121
|
GetRobotMetadataResponse,
|
|
122
|
+
GetRobotPartByNameAndLocationRequest,
|
|
123
|
+
GetRobotPartByNameAndLocationResponse,
|
|
122
124
|
GetRobotPartHistoryRequest,
|
|
123
125
|
GetRobotPartHistoryResponse,
|
|
124
126
|
GetRobotPartLogsRequest,
|
|
@@ -394,6 +396,8 @@ __all__ = [
|
|
|
394
396
|
"GetRobotAPIKeysResponse",
|
|
395
397
|
"GetRobotMetadataRequest",
|
|
396
398
|
"GetRobotMetadataResponse",
|
|
399
|
+
"GetRobotPartByNameAndLocationRequest",
|
|
400
|
+
"GetRobotPartByNameAndLocationResponse",
|
|
397
401
|
"GetRobotPartHistoryRequest",
|
|
398
402
|
"GetRobotPartHistoryResponse",
|
|
399
403
|
"GetRobotPartLogsRequest",
|
|
@@ -6,6 +6,8 @@ Do not edit manually!
|
|
|
6
6
|
from ...gen.provisioning.v1.provisioning_grpc import ProvisioningServiceBase, ProvisioningServiceStub, UnimplementedProvisioningServiceBase
|
|
7
7
|
from ...gen.provisioning.v1.provisioning_pb2 import (
|
|
8
8
|
CloudConfig,
|
|
9
|
+
ExitProvisioningRequest,
|
|
10
|
+
ExitProvisioningResponse,
|
|
9
11
|
GetNetworkListRequest,
|
|
10
12
|
GetNetworkListResponse,
|
|
11
13
|
GetSmartMachineStatusRequest,
|
|
@@ -23,6 +25,8 @@ __all__ = [
|
|
|
23
25
|
"ProvisioningServiceStub",
|
|
24
26
|
"UnimplementedProvisioningServiceBase",
|
|
25
27
|
"CloudConfig",
|
|
28
|
+
"ExitProvisioningRequest",
|
|
29
|
+
"ExitProvisioningResponse",
|
|
26
30
|
"GetNetworkListRequest",
|
|
27
31
|
"GetNetworkListResponse",
|
|
28
32
|
"GetSmartMachineStatusRequest",
|
viam/resource/easy_resource.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import inspect
|
|
2
2
|
import re
|
|
3
3
|
from abc import ABCMeta
|
|
4
|
-
from typing import Callable, ClassVar, Mapping, Sequence, Union
|
|
4
|
+
from typing import Callable, ClassVar, Mapping, Sequence, Tuple, Union
|
|
5
5
|
|
|
6
6
|
from viam.proto.app.robot import ComponentConfig
|
|
7
7
|
from viam.proto.common import ResourceName
|
|
@@ -122,7 +122,7 @@ class EasyResource:
|
|
|
122
122
|
return self
|
|
123
123
|
|
|
124
124
|
@classmethod
|
|
125
|
-
def validate_config(cls, config: ComponentConfig) -> Sequence[str]:
|
|
125
|
+
def validate_config(cls, config: ComponentConfig) -> Tuple[Sequence[str], Sequence[str]]:
|
|
126
126
|
"""This method allows you to validate the configuration object received from the machine,
|
|
127
127
|
as well as to return any implicit dependencies based on that `config`.
|
|
128
128
|
|
|
@@ -130,9 +130,9 @@ class EasyResource:
|
|
|
130
130
|
config (ComponentConfig): The configuration for this resource
|
|
131
131
|
|
|
132
132
|
Returns:
|
|
133
|
-
Sequence[str]:
|
|
133
|
+
Tuple[Sequence[str], Sequence[str]]: One list of required implicit dependencies and one of optional deps.
|
|
134
134
|
"""
|
|
135
|
-
return []
|
|
135
|
+
return [], []
|
|
136
136
|
|
|
137
137
|
@classmethod
|
|
138
138
|
def register(cls):
|
viam/resource/registry.py
CHANGED
|
@@ -27,7 +27,7 @@ class ResourceCreatorRegistration:
|
|
|
27
27
|
"""A function that can create a resource given a mapping of dependencies (``ResourceName`` to ``ResourceBase``
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
|
-
validator: "Validator" = lambda x: []
|
|
30
|
+
validator: "Validator" = lambda x: ([], [])
|
|
31
31
|
"""A function that can validate a resource and return implicit dependencies.
|
|
32
32
|
|
|
33
33
|
If called without a validator function, default to a function returning an empty Sequence
|
|
@@ -170,7 +170,7 @@ class Registry:
|
|
|
170
170
|
try:
|
|
171
171
|
return cls._RESOURCES[f"{api}/{model}"].validator
|
|
172
172
|
except AttributeError:
|
|
173
|
-
return lambda x: []
|
|
173
|
+
return lambda x: ([], [])
|
|
174
174
|
except KeyError:
|
|
175
175
|
raise ResourceNotFoundError(api.resource_type, api.resource_subtype)
|
|
176
176
|
|
viam/resource/types.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import re
|
|
2
2
|
import sys
|
|
3
|
-
from typing import TYPE_CHECKING, Callable, ClassVar, Mapping, Optional, Protocol, Sequence, runtime_checkable
|
|
3
|
+
from typing import TYPE_CHECKING, Callable, ClassVar, Mapping, Optional, Protocol, Sequence, Tuple, runtime_checkable
|
|
4
4
|
|
|
5
5
|
if sys.version_info >= (3, 10):
|
|
6
6
|
from typing import TypeAlias
|
|
@@ -203,7 +203,7 @@ def resource_name_from_string(string: str) -> ResourceName:
|
|
|
203
203
|
|
|
204
204
|
|
|
205
205
|
ResourceCreator: TypeAlias = Callable[[ComponentConfig, Mapping[ResourceName, "ResourceBase"]], "ResourceBase"]
|
|
206
|
-
Validator: TypeAlias = Callable[[ComponentConfig], Sequence[str]]
|
|
206
|
+
Validator: TypeAlias = Callable[[ComponentConfig], Tuple[Sequence[str], Sequence[str]]]
|
|
207
207
|
|
|
208
208
|
|
|
209
209
|
@runtime_checkable
|
viam/rpc/server.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import sys
|
|
1
2
|
from typing import TYPE_CHECKING, Callable, List, Optional
|
|
2
3
|
|
|
3
4
|
from grpclib import GRPCError, Status
|
|
@@ -82,6 +83,24 @@ class Server(ResourceManager):
|
|
|
82
83
|
|
|
83
84
|
event.method_func = log_resource_name
|
|
84
85
|
|
|
86
|
+
async def _serve(
|
|
87
|
+
self,
|
|
88
|
+
host: Optional[str] = "localhost",
|
|
89
|
+
port: Optional[int] = 9090,
|
|
90
|
+
log_level: Optional[int] = logging.INFO,
|
|
91
|
+
*,
|
|
92
|
+
path: Optional[str] = None,
|
|
93
|
+
):
|
|
94
|
+
if path:
|
|
95
|
+
await self._server.start(path=path)
|
|
96
|
+
LOGGER.info(f"Serving on {path}")
|
|
97
|
+
else:
|
|
98
|
+
await self._server.start(host, port)
|
|
99
|
+
LOGGER.info(f"Serving on {host}:{port}")
|
|
100
|
+
await self._server.wait_closed()
|
|
101
|
+
await self.close()
|
|
102
|
+
LOGGER.debug("gRPC server closed")
|
|
103
|
+
|
|
85
104
|
async def serve(
|
|
86
105
|
self,
|
|
87
106
|
host: Optional[str] = "localhost",
|
|
@@ -105,16 +124,11 @@ class Server(ResourceManager):
|
|
|
105
124
|
logging.setLevel(log_level)
|
|
106
125
|
listen(self._server, RecvRequest, self._grpc_recvrequest_handler)
|
|
107
126
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
await self.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
await self._server.start(host, port)
|
|
114
|
-
LOGGER.info(f"Serving on {host}:{port}")
|
|
115
|
-
await self._server.wait_closed()
|
|
116
|
-
await self.close()
|
|
117
|
-
LOGGER.debug("gRPC server closed")
|
|
127
|
+
if sys.platform != "win32":
|
|
128
|
+
with graceful_exit([self._server]):
|
|
129
|
+
await self._serve(host=host, port=port, log_level=log_level, path=path)
|
|
130
|
+
else:
|
|
131
|
+
await self._serve(host=host, port=port, log_level=log_level, path=path)
|
|
118
132
|
|
|
119
133
|
@classmethod
|
|
120
134
|
async def create_and_serve(
|
viam/version_metadata.py
CHANGED