Two more places that need the grpc imports

This commit is contained in:
sparky8512 2021-02-12 13:48:55 -08:00
parent 491227ddb4
commit ec61333710
2 changed files with 7 additions and 1 deletions

View file

@ -30,7 +30,7 @@ Note that the Python package versions available from various Linux distributions
### Generating the gRPC protocol modules ### Generating the gRPC protocol modules
This step is no longer required, as the grpc scripts can now get the protocol modules classes at run time via reflection, but generating the protocol modules will improve script startup time, and it would be a good idea to at least stash away the protoset file emitted by `grpcurl` in case SpaceX ever turns off server reflection in the dish software. This step is no longer required, as the grpc scripts can now get the protocol module classes at run time via reflection, but generating the protocol modules will improve script startup time, and it would be a good idea to at least stash away the protoset file emitted by `grpcurl` in case SpaceX ever turns off server reflection in the dish software.
The grpc scripts require some generated code to support the specific gRPC protocol messages used. These would normally be generated from .proto files that specify those messages, but to date (2020-Dec), SpaceX has not publicly released such files. The gRPC service running on the dish appears to have [server reflection](https://github.com/grpc/grpc/blob/master/doc/server-reflection.md) enabled, though. `grpcurl` can use that to extract a protoset file, and the `protoc` compiler can use that to make the necessary generated code: The grpc scripts require some generated code to support the specific gRPC protocol messages used. These would normally be generated from .proto files that specify those messages, but to date (2020-Dec), SpaceX has not publicly released such files. The gRPC service running on the dish appears to have [server reflection](https://github.com/grpc/grpc/blob/master/doc/server-reflection.md) enabled, though. `grpcurl` can use that to extract a protoset file, and the `protoc` compiler can use that to make the necessary generated code:
```shell script ```shell script

View file

@ -374,6 +374,9 @@ def status_field_names():
A tuple with 3 lists, with status data field names, alert detail field A tuple with 3 lists, with status data field names, alert detail field
names, and obstruction detail field names, in that order. names, and obstruction detail field names, in that order.
""" """
if not import_ok:
with grpc.insecure_channel("192.168.100.1:9200") as channel:
import_protocols(channel)
alert_names = [] alert_names = []
for field in dish_pb2.DishAlerts.DESCRIPTOR.fields: for field in dish_pb2.DishAlerts.DESCRIPTOR.fields:
alert_names.append("alert_" + field.name) alert_names.append("alert_" + field.name)
@ -410,6 +413,9 @@ def status_field_types():
A tuple with 3 lists, with status data field types, alert detail field A tuple with 3 lists, with status data field types, alert detail field
types, and obstruction detail field types, in that order. types, and obstruction detail field types, in that order.
""" """
if not import_ok:
with grpc.insecure_channel("192.168.100.1:9200") as channel:
import_protocols(channel)
return [ return [
str, # id str, # id
str, # hardware_version str, # hardware_version