-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from GreenTeaProgrammers:feature/machine-learn…
…ing/api/health-check Feature/machine-learning/api/health-check
- Loading branch information
Showing
18 changed files
with
579 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# proto-gen | ||
|
||
`proto-gen`は、gRPC と Protocol Buffers を使用して API を定義し、Python クライアントのために生成されたコードをまとめたディレクトリです | ||
|
||
## クライアントの実装例 | ||
|
||
`where_child_bus/v1`ディレクトリ内の`client.py`に API クライアントの実装例が含まれています。このクライアントを使用して、API を介してバスに乗っている子供の位置情報を取得することができます。 | ||
|
||
## gRPC ファイルの修正 | ||
|
||
生成された`*_grpc.py`ファイルには、いくつかの場合において import 文が不足している可能性があります。この問題は、`import grpc.experimental`を追加することで解決できます。 | ||
|
||
### 解決方法 | ||
|
||
1. `*_grpc.py`ファイルを開きます。 | ||
2. ファイルの先頭に`import grpc.experimental`を追加します。 | ||
|
||
これにより、不足していた import による問題が解決され、ファイルが正常に機能するようになります。 |
39 changes: 39 additions & 0 deletions
39
machine_learning/src/proto-gen/where_child_bus/v1/bus_pb2.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from where_child_bus.v1 import resources_pb2 as _resources_pb2 | ||
from google.protobuf.internal import containers as _containers | ||
from google.protobuf import descriptor as _descriptor | ||
from google.protobuf import message as _message | ||
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union | ||
|
||
DESCRIPTOR: _descriptor.FileDescriptor | ||
|
||
class CreateBusRequest(_message.Message): | ||
__slots__ = ("nursery_id", "name", "plate_number", "child_ids") | ||
NURSERY_ID_FIELD_NUMBER: _ClassVar[int] | ||
NAME_FIELD_NUMBER: _ClassVar[int] | ||
PLATE_NUMBER_FIELD_NUMBER: _ClassVar[int] | ||
CHILD_IDS_FIELD_NUMBER: _ClassVar[int] | ||
nursery_id: str | ||
name: str | ||
plate_number: str | ||
child_ids: _containers.RepeatedScalarFieldContainer[str] | ||
def __init__(self, nursery_id: _Optional[str] = ..., name: _Optional[str] = ..., plate_number: _Optional[str] = ..., child_ids: _Optional[_Iterable[str]] = ...) -> None: ... | ||
|
||
class CreateBusResponse(_message.Message): | ||
__slots__ = ("bus", "children") | ||
BUS_FIELD_NUMBER: _ClassVar[int] | ||
CHILDREN_FIELD_NUMBER: _ClassVar[int] | ||
bus: _resources_pb2.Bus | ||
children: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Child] | ||
def __init__(self, bus: _Optional[_Union[_resources_pb2.Bus, _Mapping]] = ..., children: _Optional[_Iterable[_Union[_resources_pb2.Child, _Mapping]]] = ...) -> None: ... | ||
|
||
class GetBusListByNurseryIdRequest(_message.Message): | ||
__slots__ = ("nursery_id",) | ||
NURSERY_ID_FIELD_NUMBER: _ClassVar[int] | ||
nursery_id: str | ||
def __init__(self, nursery_id: _Optional[str] = ...) -> None: ... | ||
|
||
class GetBusListByNurseryIdResponse(_message.Message): | ||
__slots__ = ("buses",) | ||
BUSES_FIELD_NUMBER: _ClassVar[int] | ||
buses: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Bus] | ||
def __init__(self, buses: _Optional[_Iterable[_Union[_resources_pb2.Bus, _Mapping]]] = ...) -> None: ... |
2 changes: 2 additions & 0 deletions
2
machine_learning/src/proto-gen/where_child_bus/v1/bus_pb2_grpc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
machine_learning/src/proto-gen/where_child_bus/v1/child_pb2.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
from where_child_bus.v1 import resources_pb2 as _resources_pb2 | ||
from google.protobuf.internal import containers as _containers | ||
from google.protobuf import descriptor as _descriptor | ||
from google.protobuf import message as _message | ||
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union | ||
|
||
DESCRIPTOR: _descriptor.FileDescriptor | ||
|
||
class CreateChildRequest(_message.Message): | ||
__slots__ = ("nursery_id", "guardian_id", "name", "age", "sex", "photos") | ||
NURSERY_ID_FIELD_NUMBER: _ClassVar[int] | ||
GUARDIAN_ID_FIELD_NUMBER: _ClassVar[int] | ||
NAME_FIELD_NUMBER: _ClassVar[int] | ||
AGE_FIELD_NUMBER: _ClassVar[int] | ||
SEX_FIELD_NUMBER: _ClassVar[int] | ||
PHOTOS_FIELD_NUMBER: _ClassVar[int] | ||
nursery_id: str | ||
guardian_id: str | ||
name: str | ||
age: int | ||
sex: _resources_pb2.Sex | ||
photos: _containers.RepeatedScalarFieldContainer[bytes] | ||
def __init__(self, nursery_id: _Optional[str] = ..., guardian_id: _Optional[str] = ..., name: _Optional[str] = ..., age: _Optional[int] = ..., sex: _Optional[_Union[_resources_pb2.Sex, str]] = ..., photos: _Optional[_Iterable[bytes]] = ...) -> None: ... | ||
|
||
class CreateChildResponse(_message.Message): | ||
__slots__ = ("child",) | ||
CHILD_FIELD_NUMBER: _ClassVar[int] | ||
child: _resources_pb2.Child | ||
def __init__(self, child: _Optional[_Union[_resources_pb2.Child, _Mapping]] = ...) -> None: ... | ||
|
||
class GetChildListByNurseryIDRequest(_message.Message): | ||
__slots__ = ("nursery_id",) | ||
NURSERY_ID_FIELD_NUMBER: _ClassVar[int] | ||
nursery_id: str | ||
def __init__(self, nursery_id: _Optional[str] = ...) -> None: ... | ||
|
||
class GetChildListByNurseryIDResponse(_message.Message): | ||
__slots__ = ("children",) | ||
CHILDREN_FIELD_NUMBER: _ClassVar[int] | ||
children: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Child] | ||
def __init__(self, children: _Optional[_Iterable[_Union[_resources_pb2.Child, _Mapping]]] = ...) -> None: ... | ||
|
||
class GetChildListByGuardianIDRequest(_message.Message): | ||
__slots__ = ("guardian_id",) | ||
GUARDIAN_ID_FIELD_NUMBER: _ClassVar[int] | ||
guardian_id: str | ||
def __init__(self, guardian_id: _Optional[str] = ...) -> None: ... | ||
|
||
class GetChildListByGuardianIDResponse(_message.Message): | ||
__slots__ = ("children",) | ||
CHILDREN_FIELD_NUMBER: _ClassVar[int] | ||
children: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Child] | ||
def __init__(self, children: _Optional[_Iterable[_Union[_resources_pb2.Child, _Mapping]]] = ...) -> None: ... | ||
|
||
class GetChildListByBusIDRequest(_message.Message): | ||
__slots__ = ("bus_id",) | ||
BUS_ID_FIELD_NUMBER: _ClassVar[int] | ||
bus_id: str | ||
def __init__(self, bus_id: _Optional[str] = ...) -> None: ... | ||
|
||
class GetChildListByBusIDResponse(_message.Message): | ||
__slots__ = ("children",) | ||
CHILDREN_FIELD_NUMBER: _ClassVar[int] | ||
children: _containers.RepeatedCompositeFieldContainer[_resources_pb2.Child] | ||
def __init__(self, children: _Optional[_Iterable[_Union[_resources_pb2.Child, _Mapping]]] = ...) -> None: ... |
20 changes: 20 additions & 0 deletions
20
machine_learning/src/proto-gen/where_child_bus/v1/child_photo_pb2.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from google.protobuf.internal import containers as _containers | ||
from google.protobuf import descriptor as _descriptor | ||
from google.protobuf import message as _message | ||
from typing import ClassVar as _ClassVar, Iterable as _Iterable, Optional as _Optional | ||
|
||
DESCRIPTOR: _descriptor.FileDescriptor | ||
|
||
class DeleteChildPhotoRequest(_message.Message): | ||
__slots__ = ("ids",) | ||
IDS_FIELD_NUMBER: _ClassVar[int] | ||
ids: _containers.RepeatedScalarFieldContainer[str] | ||
def __init__(self, ids: _Optional[_Iterable[str]] = ...) -> None: ... | ||
|
||
class DeleteChildPhotoResponse(_message.Message): | ||
__slots__ = ("is_success_list", "ids") | ||
IS_SUCCESS_LIST_FIELD_NUMBER: _ClassVar[int] | ||
IDS_FIELD_NUMBER: _ClassVar[int] | ||
is_success_list: _containers.RepeatedScalarFieldContainer[bool] | ||
ids: _containers.RepeatedScalarFieldContainer[str] | ||
def __init__(self, is_success_list: _Optional[_Iterable[bool]] = ..., ids: _Optional[_Iterable[str]] = ...) -> None: ... |
2 changes: 2 additions & 0 deletions
2
machine_learning/src/proto-gen/where_child_bus/v1/child_photo_pb2_grpc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
machine_learning/src/proto-gen/where_child_bus/v1/client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import grpc | ||
import health_check_pb2 | ||
import health_check_pb2_grpc | ||
|
||
|
||
ENDPOINT = 'where-child-bus-grpc-k3dkun2lpq-uw.a.run.app:443' | ||
with grpc.secure_channel(ENDPOINT, grpc.ssl_channel_credentials()) as channel: | ||
stub = health_check_pb2_grpc.HealthcheckServiceStub(channel) | ||
request = health_check_pb2.PingRequest() | ||
stub.Ping(request) | ||
request.name = 'ping' | ||
response = stub.Ping(request) | ||
print(response.message) | ||
channel.close() |
44 changes: 44 additions & 0 deletions
44
machine_learning/src/proto-gen/where_child_bus/v1/guardian_pb2.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from where_child_bus.v1 import resources_pb2 as _resources_pb2 | ||
from google.protobuf import descriptor as _descriptor | ||
from google.protobuf import message as _message | ||
from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Optional, Union as _Union | ||
|
||
DESCRIPTOR: _descriptor.FileDescriptor | ||
|
||
class CreateGuardianRequest(_message.Message): | ||
__slots__ = ("nursery_code", "email", "password", "name", "phone_number") | ||
NURSERY_CODE_FIELD_NUMBER: _ClassVar[int] | ||
EMAIL_FIELD_NUMBER: _ClassVar[int] | ||
PASSWORD_FIELD_NUMBER: _ClassVar[int] | ||
NAME_FIELD_NUMBER: _ClassVar[int] | ||
PHONE_NUMBER_FIELD_NUMBER: _ClassVar[int] | ||
nursery_code: str | ||
email: str | ||
password: str | ||
name: str | ||
phone_number: str | ||
def __init__(self, nursery_code: _Optional[str] = ..., email: _Optional[str] = ..., password: _Optional[str] = ..., name: _Optional[str] = ..., phone_number: _Optional[str] = ...) -> None: ... | ||
|
||
class CreateGuardianResponse(_message.Message): | ||
__slots__ = ("guardian",) | ||
GUARDIAN_FIELD_NUMBER: _ClassVar[int] | ||
guardian: _resources_pb2.GuardianResponse | ||
def __init__(self, guardian: _Optional[_Union[_resources_pb2.GuardianResponse, _Mapping]] = ...) -> None: ... | ||
|
||
class GuardianLoginRequest(_message.Message): | ||
__slots__ = ("email", "password") | ||
EMAIL_FIELD_NUMBER: _ClassVar[int] | ||
PASSWORD_FIELD_NUMBER: _ClassVar[int] | ||
email: str | ||
password: str | ||
def __init__(self, email: _Optional[str] = ..., password: _Optional[str] = ...) -> None: ... | ||
|
||
class GuardianLoginResponse(_message.Message): | ||
__slots__ = ("success", "guardian", "nursery") | ||
SUCCESS_FIELD_NUMBER: _ClassVar[int] | ||
GUARDIAN_FIELD_NUMBER: _ClassVar[int] | ||
NURSERY_FIELD_NUMBER: _ClassVar[int] | ||
success: bool | ||
guardian: _resources_pb2.GuardianResponse | ||
nursery: _resources_pb2.NurseryResponse | ||
def __init__(self, success: bool = ..., guardian: _Optional[_Union[_resources_pb2.GuardianResponse, _Mapping]] = ..., nursery: _Optional[_Union[_resources_pb2.NurseryResponse, _Mapping]] = ...) -> None: ... |
1 change: 1 addition & 0 deletions
1
machine_learning/src/proto-gen/where_child_bus/v1/guardian_pb2_grpc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
machine_learning/src/proto-gen/where_child_bus/v1/health_check_pb2.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from google.protobuf import descriptor as _descriptor | ||
from google.protobuf import message as _message | ||
from typing import ClassVar as _ClassVar, Optional as _Optional | ||
|
||
DESCRIPTOR: _descriptor.FileDescriptor | ||
|
||
class PingRequest(_message.Message): | ||
__slots__ = ("name",) | ||
NAME_FIELD_NUMBER: _ClassVar[int] | ||
name: str | ||
def __init__(self, name: _Optional[str] = ...) -> None: ... | ||
|
||
class PingResponse(_message.Message): | ||
__slots__ = ("message",) | ||
MESSAGE_FIELD_NUMBER: _ClassVar[int] | ||
message: str | ||
def __init__(self, message: _Optional[str] = ...) -> None: ... |
1 change: 1 addition & 0 deletions
1
machine_learning/src/proto-gen/where_child_bus/v1/health_check_pb2_grpc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
machine_learning/src/proto-gen/where_child_bus/v1/healthcheck.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import sys | ||
import os | ||
|
||
# このスクリプトが存在するディレクトリの親ディレクトリを検索パスに追加 | ||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
|
||
import health_check_pb2_grpc | ||
import health_check_pb2 | ||
|
||
import grpc | ||
|
||
# gRPCクライアントの設定 | ||
client = grpc.insecure_channel('where-child-bus-grpc-k3dkun2lpq-uw.a.run.app:443') | ||
stub = health_check_pb2_grpc.HealthcheckServiceStub(client) | ||
|
||
reqst = health_check_pb2.PingRequest() | ||
reqst.name = "ping" | ||
|
||
res = health_check_pb2.PingResponse(stub.Ping(reqst)) | ||
|
||
print(res.message) | ||
|
42 changes: 42 additions & 0 deletions
42
machine_learning/src/proto-gen/where_child_bus/v1/nursery_pb2.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from where_child_bus.v1 import resources_pb2 as _resources_pb2 | ||
from google.protobuf import descriptor as _descriptor | ||
from google.protobuf import message as _message | ||
from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Optional, Union as _Union | ||
|
||
DESCRIPTOR: _descriptor.FileDescriptor | ||
|
||
class CreateNurseryRequest(_message.Message): | ||
__slots__ = ("email", "password", "name", "phone_number", "address") | ||
EMAIL_FIELD_NUMBER: _ClassVar[int] | ||
PASSWORD_FIELD_NUMBER: _ClassVar[int] | ||
NAME_FIELD_NUMBER: _ClassVar[int] | ||
PHONE_NUMBER_FIELD_NUMBER: _ClassVar[int] | ||
ADDRESS_FIELD_NUMBER: _ClassVar[int] | ||
email: str | ||
password: str | ||
name: str | ||
phone_number: str | ||
address: str | ||
def __init__(self, email: _Optional[str] = ..., password: _Optional[str] = ..., name: _Optional[str] = ..., phone_number: _Optional[str] = ..., address: _Optional[str] = ...) -> None: ... | ||
|
||
class CreateNurseryResponse(_message.Message): | ||
__slots__ = ("nursery",) | ||
NURSERY_FIELD_NUMBER: _ClassVar[int] | ||
nursery: _resources_pb2.NurseryResponse | ||
def __init__(self, nursery: _Optional[_Union[_resources_pb2.NurseryResponse, _Mapping]] = ...) -> None: ... | ||
|
||
class NurseryLoginRequest(_message.Message): | ||
__slots__ = ("email", "password") | ||
EMAIL_FIELD_NUMBER: _ClassVar[int] | ||
PASSWORD_FIELD_NUMBER: _ClassVar[int] | ||
email: str | ||
password: str | ||
def __init__(self, email: _Optional[str] = ..., password: _Optional[str] = ...) -> None: ... | ||
|
||
class NurseryLoginResponse(_message.Message): | ||
__slots__ = ("success", "nursery") | ||
SUCCESS_FIELD_NUMBER: _ClassVar[int] | ||
NURSERY_FIELD_NUMBER: _ClassVar[int] | ||
success: bool | ||
nursery: _resources_pb2.NurseryResponse | ||
def __init__(self, success: bool = ..., nursery: _Optional[_Union[_resources_pb2.NurseryResponse, _Mapping]] = ...) -> None: ... |
2 changes: 2 additions & 0 deletions
2
machine_learning/src/proto-gen/where_child_bus/v1/nursery_pb2_grpc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.