This is an automated email from the ASF dual-hosted git repository. smarru pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/airavata-sandbox.git
commit 76c6e42b3ad98501cb9bc2663c839e7494112c71 Author: Bhavesh Asanabada <bhavesh@Bhavesh-MacBook.local> AuthorDate: Mon Sep 12 13:45:35 2022 +0530 added the rpc streamline --- gsoc2022/smilesdb/rpc_handler/calc_info_pb2.py | 137 ++++++++++++++ .../smilesdb/rpc_handler/calc_info_pb2_grpc.py | 198 +++++++++++++++++++++ .../smilesdb/rpc_handler/dataHandler/__init__.py | 0 .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 169 bytes .../__pycache__/__init__.cpython-39.pyc | Bin 0 -> 169 bytes .../dataHandler/__pycache__/admin.cpython-38.pyc | Bin 0 -> 210 bytes .../dataHandler/__pycache__/admin.cpython-39.pyc | Bin 0 -> 210 bytes .../dataHandler/__pycache__/apps.cpython-38.pyc | Bin 0 -> 456 bytes .../dataHandler/__pycache__/apps.cpython-39.pyc | Bin 0 -> 456 bytes .../dataHandler/__pycache__/models.cpython-38.pyc | Bin 0 -> 207 bytes .../dataHandler/__pycache__/models.cpython-39.pyc | Bin 0 -> 207 bytes .../dataHandler/__pycache__/urls.cpython-38.pyc | Bin 0 -> 290 bytes .../dataHandler/__pycache__/urls.cpython-39.pyc | Bin 0 -> 290 bytes .../dataHandler/__pycache__/views.cpython-38.pyc | Bin 0 -> 2643 bytes .../dataHandler/__pycache__/views.cpython-39.pyc | Bin 0 -> 2655 bytes gsoc2022/smilesdb/rpc_handler/dataHandler/admin.py | 3 + gsoc2022/smilesdb/rpc_handler/dataHandler/apps.py | 6 + .../rpc_handler/dataHandler/code_gen/__init__.py | 0 .../code_gen/__pycache__/__init__.cpython-39.pyc | Bin 0 -> 178 bytes .../rpc_handler/dataHandler/migrations/__init__.py | 0 .../migrations/__pycache__/__init__.cpython-38.pyc | Bin 0 -> 180 bytes .../migrations/__pycache__/__init__.cpython-39.pyc | Bin 0 -> 180 bytes .../smilesdb/rpc_handler/dataHandler/models.py | 3 + .../rpc_handler/dataHandler/protos/calc_info.proto | 73 ++++++++ .../rpc_handler/dataHandler/protos/molecule.proto | 116 ++++++++++++ gsoc2022/smilesdb/rpc_handler/dataHandler/tests.py | 3 + gsoc2022/smilesdb/rpc_handler/dataHandler/urls.py | 7 + gsoc2022/smilesdb/rpc_handler/dataHandler/views.py | 128 +++++++++++++ gsoc2022/smilesdb/rpc_handler/db.sqlite3 | 0 gsoc2022/smilesdb/rpc_handler/manage.py | 22 +++ gsoc2022/smilesdb/rpc_handler/molecule_pb2.py | 137 ++++++++++++++ gsoc2022/smilesdb/rpc_handler/molecule_pb2_grpc.py | 198 +++++++++++++++++++++ gsoc2022/smilesdb/rpc_handler/requirements.txt | 12 ++ .../smilesdb/rpc_handler/rpc_handler/__init__.py | 0 .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 169 bytes .../__pycache__/__init__.cpython-39.pyc | Bin 0 -> 169 bytes .../__pycache__/settings.cpython-38.pyc | Bin 0 -> 2516 bytes .../__pycache__/settings.cpython-39.pyc | Bin 0 -> 2446 bytes .../rpc_handler/__pycache__/urls.cpython-38.pyc | Bin 0 -> 1006 bytes .../rpc_handler/__pycache__/urls.cpython-39.pyc | Bin 0 -> 1006 bytes .../rpc_handler/__pycache__/wsgi.cpython-38.pyc | Bin 0 -> 580 bytes .../rpc_handler/__pycache__/wsgi.cpython-39.pyc | Bin 0 -> 580 bytes gsoc2022/smilesdb/rpc_handler/rpc_handler/asgi.py | 16 ++ .../smilesdb/rpc_handler/rpc_handler/settings.py | 118 ++++++++++++ gsoc2022/smilesdb/rpc_handler/rpc_handler/urls.py | 24 +++ gsoc2022/smilesdb/rpc_handler/rpc_handler/wsgi.py | 16 ++ 46 files changed, 1217 insertions(+) diff --git a/gsoc2022/smilesdb/rpc_handler/calc_info_pb2.py b/gsoc2022/smilesdb/rpc_handler/calc_info_pb2.py new file mode 100644 index 00000000..892bcfd3 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/calc_info_pb2.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: calc_info.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0f\x63\x61lc_info.proto\x12\x08\x63\x61lcInfo\"\x8a\x01\n\x08\x43\x61lcInfo\x12\x13\n\x0b\x63\x61lcinfo_id\x18\x01 \x01(\t\x12\x0e\n\x06smiles\x18\x02 \x01(\t\x12\x0e\n\x06nbasis\x18\x03 \x01(\x03\x12\x0b\n\x03nmo\x18\x04 \x01(\x03\x12\x0e\n\x06nalpha\x18\x05 \x01(\x03\x12\r\n\x05nbeta\x18\x06 \x01(\x03\x12\r\n\x05natom\x18\x07 \x01(\x03\x12\x0e\n\x06\x65nergy\x18\x08 \x01(\x01\"9\n\x11\x43reateInfoRequest\x12$\n\x08\x63\x61 [...] + + + +_CALCINFO = DESCRIPTOR.message_types_by_name['CalcInfo'] +_CREATEINFOREQUEST = DESCRIPTOR.message_types_by_name['CreateInfoRequest'] +_CREATEINFORESPONSE = DESCRIPTOR.message_types_by_name['CreateInfoResponse'] +_READINFOREQUEST = DESCRIPTOR.message_types_by_name['ReadInfoRequest'] +_READINFORESPONSE = DESCRIPTOR.message_types_by_name['ReadInfoResponse'] +_UPDATEINFOREQUEST = DESCRIPTOR.message_types_by_name['UpdateInfoRequest'] +_UPDATEINFORESPONSE = DESCRIPTOR.message_types_by_name['UpdateInfoResponse'] +_DELETEINFOREQUEST = DESCRIPTOR.message_types_by_name['DeleteInfoRequest'] +_DELETEINFORESPONSE = DESCRIPTOR.message_types_by_name['DeleteInfoResponse'] +_LISTINFOREQUEST = DESCRIPTOR.message_types_by_name['ListInfoRequest'] +_LISTINFORESPONSE = DESCRIPTOR.message_types_by_name['ListInfoResponse'] +CalcInfo = _reflection.GeneratedProtocolMessageType('CalcInfo', (_message.Message,), { + 'DESCRIPTOR' : _CALCINFO, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.CalcInfo) + }) +_sym_db.RegisterMessage(CalcInfo) + +CreateInfoRequest = _reflection.GeneratedProtocolMessageType('CreateInfoRequest', (_message.Message,), { + 'DESCRIPTOR' : _CREATEINFOREQUEST, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.CreateInfoRequest) + }) +_sym_db.RegisterMessage(CreateInfoRequest) + +CreateInfoResponse = _reflection.GeneratedProtocolMessageType('CreateInfoResponse', (_message.Message,), { + 'DESCRIPTOR' : _CREATEINFORESPONSE, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.CreateInfoResponse) + }) +_sym_db.RegisterMessage(CreateInfoResponse) + +ReadInfoRequest = _reflection.GeneratedProtocolMessageType('ReadInfoRequest', (_message.Message,), { + 'DESCRIPTOR' : _READINFOREQUEST, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.ReadInfoRequest) + }) +_sym_db.RegisterMessage(ReadInfoRequest) + +ReadInfoResponse = _reflection.GeneratedProtocolMessageType('ReadInfoResponse', (_message.Message,), { + 'DESCRIPTOR' : _READINFORESPONSE, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.ReadInfoResponse) + }) +_sym_db.RegisterMessage(ReadInfoResponse) + +UpdateInfoRequest = _reflection.GeneratedProtocolMessageType('UpdateInfoRequest', (_message.Message,), { + 'DESCRIPTOR' : _UPDATEINFOREQUEST, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.UpdateInfoRequest) + }) +_sym_db.RegisterMessage(UpdateInfoRequest) + +UpdateInfoResponse = _reflection.GeneratedProtocolMessageType('UpdateInfoResponse', (_message.Message,), { + 'DESCRIPTOR' : _UPDATEINFORESPONSE, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.UpdateInfoResponse) + }) +_sym_db.RegisterMessage(UpdateInfoResponse) + +DeleteInfoRequest = _reflection.GeneratedProtocolMessageType('DeleteInfoRequest', (_message.Message,), { + 'DESCRIPTOR' : _DELETEINFOREQUEST, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.DeleteInfoRequest) + }) +_sym_db.RegisterMessage(DeleteInfoRequest) + +DeleteInfoResponse = _reflection.GeneratedProtocolMessageType('DeleteInfoResponse', (_message.Message,), { + 'DESCRIPTOR' : _DELETEINFORESPONSE, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.DeleteInfoResponse) + }) +_sym_db.RegisterMessage(DeleteInfoResponse) + +ListInfoRequest = _reflection.GeneratedProtocolMessageType('ListInfoRequest', (_message.Message,), { + 'DESCRIPTOR' : _LISTINFOREQUEST, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.ListInfoRequest) + }) +_sym_db.RegisterMessage(ListInfoRequest) + +ListInfoResponse = _reflection.GeneratedProtocolMessageType('ListInfoResponse', (_message.Message,), { + 'DESCRIPTOR' : _LISTINFORESPONSE, + '__module__' : 'calc_info_pb2' + # @@protoc_insertion_point(class_scope:calcInfo.ListInfoResponse) + }) +_sym_db.RegisterMessage(ListInfoResponse) + +_CALCINFOSERVICE = DESCRIPTOR.services_by_name['CalcInfoService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + _CALCINFO._serialized_start=30 + _CALCINFO._serialized_end=168 + _CREATEINFOREQUEST._serialized_start=170 + _CREATEINFOREQUEST._serialized_end=227 + _CREATEINFORESPONSE._serialized_start=229 + _CREATEINFORESPONSE._serialized_end=287 + _READINFOREQUEST._serialized_start=289 + _READINFOREQUEST._serialized_end=318 + _READINFORESPONSE._serialized_start=320 + _READINFORESPONSE._serialized_end=376 + _UPDATEINFOREQUEST._serialized_start=378 + _UPDATEINFOREQUEST._serialized_end=435 + _UPDATEINFORESPONSE._serialized_start=437 + _UPDATEINFORESPONSE._serialized_end=495 + _DELETEINFOREQUEST._serialized_start=497 + _DELETEINFOREQUEST._serialized_end=537 + _DELETEINFORESPONSE._serialized_start=539 + _DELETEINFORESPONSE._serialized_end=580 + _LISTINFOREQUEST._serialized_start=582 + _LISTINFOREQUEST._serialized_end=599 + _LISTINFORESPONSE._serialized_start=601 + _LISTINFORESPONSE._serialized_end=657 + _CALCINFOSERVICE._serialized_start=660 + _CALCINFOSERVICE._serialized_end=1062 +# @@protoc_insertion_point(module_scope) diff --git a/gsoc2022/smilesdb/rpc_handler/calc_info_pb2_grpc.py b/gsoc2022/smilesdb/rpc_handler/calc_info_pb2_grpc.py new file mode 100644 index 00000000..8d9dfc65 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/calc_info_pb2_grpc.py @@ -0,0 +1,198 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +import calc_info_pb2 as calc__info__pb2 + + +class CalcInfoServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.CreateCalcinfo = channel.unary_unary( + '/calcInfo.CalcInfoService/CreateCalcinfo', + request_serializer=calc__info__pb2.CreateInfoRequest.SerializeToString, + response_deserializer=calc__info__pb2.CreateInfoResponse.FromString, + ) + self.ReadCalcInfo = channel.unary_unary( + '/calcInfo.CalcInfoService/ReadCalcInfo', + request_serializer=calc__info__pb2.ReadInfoRequest.SerializeToString, + response_deserializer=calc__info__pb2.ReadInfoResponse.FromString, + ) + self.UpdateCalcInfo = channel.unary_unary( + '/calcInfo.CalcInfoService/UpdateCalcInfo', + request_serializer=calc__info__pb2.UpdateInfoRequest.SerializeToString, + response_deserializer=calc__info__pb2.UpdateInfoResponse.FromString, + ) + self.DeleteCalcInfo = channel.unary_unary( + '/calcInfo.CalcInfoService/DeleteCalcInfo', + request_serializer=calc__info__pb2.DeleteInfoRequest.SerializeToString, + response_deserializer=calc__info__pb2.DeleteInfoResponse.FromString, + ) + self.ListCalcInfo = channel.unary_stream( + '/calcInfo.CalcInfoService/ListCalcInfo', + request_serializer=calc__info__pb2.ListInfoRequest.SerializeToString, + response_deserializer=calc__info__pb2.ListInfoResponse.FromString, + ) + + +class CalcInfoServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def CreateCalcinfo(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ReadCalcInfo(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def UpdateCalcInfo(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def DeleteCalcInfo(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ListCalcInfo(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_CalcInfoServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'CreateCalcinfo': grpc.unary_unary_rpc_method_handler( + servicer.CreateCalcinfo, + request_deserializer=calc__info__pb2.CreateInfoRequest.FromString, + response_serializer=calc__info__pb2.CreateInfoResponse.SerializeToString, + ), + 'ReadCalcInfo': grpc.unary_unary_rpc_method_handler( + servicer.ReadCalcInfo, + request_deserializer=calc__info__pb2.ReadInfoRequest.FromString, + response_serializer=calc__info__pb2.ReadInfoResponse.SerializeToString, + ), + 'UpdateCalcInfo': grpc.unary_unary_rpc_method_handler( + servicer.UpdateCalcInfo, + request_deserializer=calc__info__pb2.UpdateInfoRequest.FromString, + response_serializer=calc__info__pb2.UpdateInfoResponse.SerializeToString, + ), + 'DeleteCalcInfo': grpc.unary_unary_rpc_method_handler( + servicer.DeleteCalcInfo, + request_deserializer=calc__info__pb2.DeleteInfoRequest.FromString, + response_serializer=calc__info__pb2.DeleteInfoResponse.SerializeToString, + ), + 'ListCalcInfo': grpc.unary_stream_rpc_method_handler( + servicer.ListCalcInfo, + request_deserializer=calc__info__pb2.ListInfoRequest.FromString, + response_serializer=calc__info__pb2.ListInfoResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'calcInfo.CalcInfoService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class CalcInfoService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def CreateCalcinfo(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/calcInfo.CalcInfoService/CreateCalcinfo', + calc__info__pb2.CreateInfoRequest.SerializeToString, + calc__info__pb2.CreateInfoResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def ReadCalcInfo(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/calcInfo.CalcInfoService/ReadCalcInfo', + calc__info__pb2.ReadInfoRequest.SerializeToString, + calc__info__pb2.ReadInfoResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def UpdateCalcInfo(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/calcInfo.CalcInfoService/UpdateCalcInfo', + calc__info__pb2.UpdateInfoRequest.SerializeToString, + calc__info__pb2.UpdateInfoResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def DeleteCalcInfo(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/calcInfo.CalcInfoService/DeleteCalcInfo', + calc__info__pb2.DeleteInfoRequest.SerializeToString, + calc__info__pb2.DeleteInfoResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def ListCalcInfo(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/calcInfo.CalcInfoService/ListCalcInfo', + calc__info__pb2.ListInfoRequest.SerializeToString, + calc__info__pb2.ListInfoResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__init__.py b/gsoc2022/smilesdb/rpc_handler/dataHandler/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/__init__.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 00000000..31d3aae6 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/__init__.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/__init__.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 00000000..f107629d Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/__init__.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/admin.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/admin.cpython-38.pyc new file mode 100644 index 00000000..2cab69ad Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/admin.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/admin.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/admin.cpython-39.pyc new file mode 100644 index 00000000..9e06f566 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/admin.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/apps.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/apps.cpython-38.pyc new file mode 100644 index 00000000..3dfc1e4d Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/apps.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/apps.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/apps.cpython-39.pyc new file mode 100644 index 00000000..4567e629 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/apps.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/models.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/models.cpython-38.pyc new file mode 100644 index 00000000..a0f76f8b Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/models.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/models.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/models.cpython-39.pyc new file mode 100644 index 00000000..18145557 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/models.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/urls.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/urls.cpython-38.pyc new file mode 100644 index 00000000..af69a343 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/urls.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/urls.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/urls.cpython-39.pyc new file mode 100644 index 00000000..2cf3fcfc Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/urls.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/views.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/views.cpython-38.pyc new file mode 100644 index 00000000..a595eb78 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/views.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/views.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/views.cpython-39.pyc new file mode 100644 index 00000000..c3b154a8 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/__pycache__/views.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/admin.py b/gsoc2022/smilesdb/rpc_handler/dataHandler/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/dataHandler/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/apps.py b/gsoc2022/smilesdb/rpc_handler/dataHandler/apps.py new file mode 100644 index 00000000..80d9b1c1 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/dataHandler/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DatahandlerConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "dataHandler" diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/code_gen/__init__.py b/gsoc2022/smilesdb/rpc_handler/dataHandler/code_gen/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/code_gen/__pycache__/__init__.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/code_gen/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 00000000..4f0fdadf Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/code_gen/__pycache__/__init__.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/migrations/__init__.py b/gsoc2022/smilesdb/rpc_handler/dataHandler/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/migrations/__pycache__/__init__.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/migrations/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 00000000..177f38c8 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/migrations/__pycache__/__init__.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/migrations/__pycache__/__init__.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/dataHandler/migrations/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 00000000..5e274caf Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/dataHandler/migrations/__pycache__/__init__.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/models.py b/gsoc2022/smilesdb/rpc_handler/dataHandler/models.py new file mode 100644 index 00000000..71a83623 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/dataHandler/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/protos/calc_info.proto b/gsoc2022/smilesdb/rpc_handler/dataHandler/protos/calc_info.proto new file mode 100644 index 00000000..a582e395 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/dataHandler/protos/calc_info.proto @@ -0,0 +1,73 @@ +syntax = "proto3"; +package calcInfo; + +message CalcInfo{ + // System generated key + string calcinfo_id = 1; + // Primary key + string smiles = 2; + // The number of basis functions for the computation. number + int64 nbasis = 3; + // The number of molecular orbitals for the computation. number + int64 nmo = 4; + // The number of alpha electrons in the computation. number + int64 nalpha = 5; + // The number of beta electrons in the computation. number + int64 nbeta = 6; + // The number of atoms in the computation. number + int64 natom = 7; + // The energy of the requested method, identical to return_value for energy computations. number + double energy = 8; + +} + +message CreateInfoRequest { + CalcInfo calcInfo = 1; +} + +message CreateInfoResponse { + CalcInfo calcInfo = 1; +} + +message ReadInfoRequest { + string id = 1; +} + +message ReadInfoResponse { + CalcInfo calcInfo = 1; +} + +message UpdateInfoRequest { + CalcInfo calcInfo = 1; +} + +message UpdateInfoResponse { + CalcInfo calcInfo = 1; +} + +message DeleteInfoRequest { + string calcInfo_id = 1; +} + +message DeleteInfoResponse { + string calcInfo_id = 1; +} + +message ListInfoRequest {} + +message ListInfoResponse { + CalcInfo calcInfo = 1; +} + + +service CalcInfoService { + rpc CreateCalcinfo (CreateInfoRequest) returns (CreateInfoResponse) {}; + rpc ReadCalcInfo (ReadInfoRequest) returns (ReadInfoResponse) {}; + rpc UpdateCalcInfo (UpdateInfoRequest) returns (UpdateInfoResponse) {}; + rpc DeleteCalcInfo (DeleteInfoRequest) returns (DeleteInfoResponse) {}; + rpc ListCalcInfo (ListInfoRequest) returns (stream ListInfoResponse) {}; +} + + + +// python -m grpc_tools.protoc --proto_path=./ --python_out=../codegen --grpc_python_out=../codegen ./calc_info.proto \ No newline at end of file diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/protos/molecule.proto b/gsoc2022/smilesdb/rpc_handler/dataHandler/protos/molecule.proto new file mode 100644 index 00000000..542afa3b --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/dataHandler/protos/molecule.proto @@ -0,0 +1,116 @@ +syntax="proto3"; +package molecule; + +message Molecule { + string mol_id = 1; + string cas_nr = 2; + string smiles = 3; + string smiles_stereo = 4; + string inchi = 5; + string molfile_blob_source = 6; + string emp_formula = 7; + string emp_formula_sort = 8; + string emp_formula_source = 9; + double mw = 10; + double mw_monoiso = 11; + double rdb = 12; + string mw_source = 13; + string validated_by = 14; + string journal = 15; + string auth_of_intr = 16; + string jour_cit = 17; + string year_publ = 18; + string doi_link = 19; + string comp_class = 20; + string cuniq = 21; + string calc_perf = 22; + string org_met = 23; + int64 mol_chrg = 24; + string state_ofmat = 25; + string color_white = 26; + string color_uv = 27; + double absorb_max = 28; + string solvent_ae = 29; + double absorb = 30; + double conc = 31; + double extinc = 32; + double emis_max = 33; + double temp_abs = 34; + double emis_qy = 35; + double temp_ems = 36; + double lifetime = 37; + double temp_cv = 38; + double reduc_pot = 39; + string hw_or_pk_rp = 40; + double oxid_pot = 41; + string hw_or_pk_op = 42; + string solvent_cv = 43; + string electrolyte = 44; + string ref_electrd = 45; + string inter_thngs = 46; + double density_20 = 47; + string density_20_source = 48; + double default_warn_level = 49; + double n_20 = 50; + string n_20_source = 51; + double mp_low = 52; + double mp_high = 53; + string mp_source = 54; + double bp_low = 55; + double bp_high = 56; + double bp_press = 57; + string press_unit = 58; + string bp_source = 59; + string safety_r = 60; + string safety_h = 61; + string safety_s = 62; + string safety_p = 63; + string safety_text = 64; + string safety_sym = 65; + string safety_sym_ghs = 66; + string safety_source = 67; + string comment_mol = 68; +} + +message CreateMoleculeRequest{ + Molecule molecule = 1; +} +message CreateMoleculeResponse{ + Molecule molecule = 1; +} + +message ReadMoleculeRequest{ + string id = 1; +} +message ReadMoleculeResponse{ + Molecule molecule = 1; +} + +message UpdateMoleculeRequest{ + Molecule molecule = 1; +} +message UpdateMoleculeResponse{ + Molecule molecule = 1; +} + +message DeleteMoleculeRequest{ + string molecule_id = 1; +} +message DeleteMoleculeResponse{ + string molecule_id = 1; +} + +message ListMoleculeRequest{ +} + +message ListMoleculeResponse{ + Molecule molecule = 1; +} + +service MoleculeService{ + rpc CreateMolecule(CreateMoleculeRequest) returns (CreateMoleculeResponse){}; + rpc ReadMolecule(ReadMoleculeRequest) returns (ReadMoleculeResponse){}; + rpc UpdateMolecule(UpdateMoleculeRequest) returns (UpdateMoleculeResponse){}; + rpc DeleteMolecule(DeleteMoleculeRequest) returns (DeleteMoleculeResponse){}; + rpc ListMolecule(ListMoleculeRequest) returns (stream ListMoleculeResponse){}; +} diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/tests.py b/gsoc2022/smilesdb/rpc_handler/dataHandler/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/dataHandler/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/urls.py b/gsoc2022/smilesdb/rpc_handler/dataHandler/urls.py new file mode 100644 index 00000000..902b8e88 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/dataHandler/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('molecule/', views.client), +] diff --git a/gsoc2022/smilesdb/rpc_handler/dataHandler/views.py b/gsoc2022/smilesdb/rpc_handler/dataHandler/views.py new file mode 100644 index 00000000..57ca0799 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/dataHandler/views.py @@ -0,0 +1,128 @@ +import grpc +from django.http import JsonResponse, HttpResponse +from django.views.decorators.csrf import csrf_exempt + +import calc_info_pb2_grpc +import calc_info_pb2 +import molecule_pb2 +import molecule_pb2_grpc + + +# def calcInfoData(channel): +# stub = calc_info_pb2_grpc.CalcInfoServiceStub(channel) +# rpc_log = stub.ListCalcInfo(calc_info_pb2.ListInfoRequest()) +# data_log = [] +# for infoData in rpc_log: +# data = { +# 'calcinfo_id': infoData.calcInfo.calcinfo_id, +# 'smiles': infoData.calcInfo.smiles, +# 'nbasis': infoData.calcInfo.nbasis, +# 'nmo': infoData.calcInfo.nmo, +# 'nalpha': infoData.calcInfo.nalpha, +# 'nbeta': infoData.calcInfo.nbeta, +# 'natom': infoData.calcInfo.natom, +# 'energy': infoData.calcInfo.energy +# } +# data_log.append(data) +# return data_log + + +# def readCalcInfoData(channel): +# stub = calc_info_pb2_grpc.CalcInfoServiceStub(channel) +# rpc_log = stub.ReadCalcInfo(calc_info_pb2.ReadInfoRequest(id='630f26040e217430d0ce8f5d')) +# return rpc_log + +# +# def readMoleculeData(channel): +# stub = molecule_pb2_grpc.MoleculeServiceStub(channel) +# rpc_log = stub.ReadMolecule(molecule_pb2.ReadMoleculeRequest(id='631c8b3a263f4bd508d11ef1')) +# return rpc_log + + +def ListmoleculeData(channel): + stub = molecule_pb2_grpc.MoleculeServiceStub(channel) + rpc_log = stub.ListMolecule(molecule_pb2.ListMoleculeRequest()) + data_log = [] + + for molData in rpc_log: + data = { + 'mol_id': molData.molecule.mol_id, + 'cas_nr': molData.molecule.cas_nr, + 'smiles': molData.molecule.smiles, + 'smiles_stereo': molData.molecule.smiles_stereo, + 'inchi': molData.molecule.inchi, + 'molfile_blob_source': molData.molecule.molfile_blob_source, + 'emp_formula': molData.molecule.emp_formula, + 'emp_formula_sort': molData.molecule.emp_formula_sort, + 'emp_formula_source': molData.molecule.emp_formula_source, + 'mw': molData.molecule.mw, + 'mw_monoiso': molData.molecule.mw_monoiso, + 'rdb': molData.molecule.rdb, + 'mw_source': molData.molecule.mw_source, + 'validated_by': molData.molecule.validated_by, + 'journal': molData.molecule.journal, + 'auth_of_intr': molData.molecule.auth_of_intr, + 'jour_cit': molData.molecule.jour_cit, + 'year_publ': molData.molecule.year_publ, + 'doi_link': molData.molecule.doi_link, + 'comp_class': molData.molecule.comp_class, + 'cuniq': molData.molecule.cuniq, + 'calc_perf': molData.molecule.calc_perf, + 'org_met': molData.molecule.org_met, + 'mol_chrg': molData.molecule.mol_chrg, + 'state_ofmat': molData.molecule.state_ofmat, + 'color_white': molData.molecule.color_white, + 'color_uv': molData.molecule.color_uv, + 'absorb_max': molData.molecule.absorb_max, + 'solvent_ae': molData.molecule.solvent_ae, + 'absorb': molData.molecule.absorb, + 'conc': molData.molecule.conc, + 'extinc': molData.molecule.extinc, + 'emis_max': molData.molecule.emis_max, + 'temp_abs': molData.molecule.temp_abs, + 'emis_qy': molData.molecule.emis_qy, + 'temp_ems': molData.molecule.temp_ems, + 'lifetime': molData.molecule.lifetime, + 'temp_cv': molData.molecule.temp_cv, + 'reduc_pot': molData.molecule.reduc_pot, + 'hw_or_pk_rp': molData.molecule.hw_or_pk_rp, + 'oxid_pot': molData.molecule.oxid_pot, + 'hw_or_pk_op': molData.molecule.hw_or_pk_op, + 'solvent_cv': molData.molecule.solvent_cv, + 'electrolyte': molData.molecule.electrolyte, + 'ref_electrd': molData.molecule.ref_electrd, + 'inter_thngs': molData.molecule.inter_thngs, + 'density_20': molData.molecule.density_20, + 'density_20_source': molData.molecule.density_20_source, + 'default_warn_level': molData.molecule.default_warn_level, + 'n_20': molData.molecule.n_20, + 'n_20_source': molData.molecule.n_20_source, + 'mp_low': molData.molecule.mp_low, + 'mp_high': molData.molecule.mp_high, + 'mp_source': molData.molecule.mp_source, + 'bp_low': molData.molecule.bp_low, + 'bp_high': molData.molecule.bp_high, + 'bp_press': molData.molecule.bp_press, + 'press_unit': molData.molecule.press_unit, + 'bp_source': molData.molecule.bp_source, + 'safety_r': molData.molecule.safety_r, + 'safety_h': molData.molecule.safety_h, + 'safety_s': molData.molecule.safety_s, + 'safety_p': molData.molecule.safety_p, + 'safety_text': molData.molecule.safety_text, + 'safety_sym': molData.molecule.safety_sym, + 'safety_sym_ghs': molData.molecule.safety_sym_ghs, + 'safety_source': molData.molecule.safety_source, + 'comment_mol': molData.molecule.comment_mol, + } + data_log.append(data) + return data_log + +@csrf_exempt +def client(request): + if request.method == 'GET': + print(request) + with grpc.insecure_channel('localhost:50051') as channel: + # return JsonResponse(calcInfoData(channel), safe=False) + # return HttpResponse(ListmoleculeData(channel)) + return JsonResponse(ListmoleculeData(channel), safe=False) diff --git a/gsoc2022/smilesdb/rpc_handler/db.sqlite3 b/gsoc2022/smilesdb/rpc_handler/db.sqlite3 new file mode 100644 index 00000000..e69de29b diff --git a/gsoc2022/smilesdb/rpc_handler/manage.py b/gsoc2022/smilesdb/rpc_handler/manage.py new file mode 100755 index 00000000..2b8cc724 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rpc_handler.settings") + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == "__main__": + main() diff --git a/gsoc2022/smilesdb/rpc_handler/molecule_pb2.py b/gsoc2022/smilesdb/rpc_handler/molecule_pb2.py new file mode 100644 index 00000000..1e8d1baf --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/molecule_pb2.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: molecule.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0emolecule.proto\x12\x08molecule\"\xa4\n\n\x08Molecule\x12\x0e\n\x06mol_id\x18\x01 \x01(\t\x12\x0e\n\x06\x63\x61s_nr\x18\x02 \x01(\t\x12\x0e\n\x06smiles\x18\x03 \x01(\t\x12\x15\n\rsmiles_stereo\x18\x04 \x01(\t\x12\r\n\x05inchi\x18\x05 \x01(\t\x12\x1b\n\x13molfile_blob_source\x18\x06 \x01(\t\x12\x13\n\x0b\x65mp_formula\x18\x07 \x01(\t\x12\x18\n\x10\x65mp_formula_sort\x18\x08 \x01(\t\x12\x1a\n\x12\x65mp_formula_source\x18\t \x [...] + + + +_MOLECULE = DESCRIPTOR.message_types_by_name['Molecule'] +_CREATEMOLECULEREQUEST = DESCRIPTOR.message_types_by_name['CreateMoleculeRequest'] +_CREATEMOLECULERESPONSE = DESCRIPTOR.message_types_by_name['CreateMoleculeResponse'] +_READMOLECULEREQUEST = DESCRIPTOR.message_types_by_name['ReadMoleculeRequest'] +_READMOLECULERESPONSE = DESCRIPTOR.message_types_by_name['ReadMoleculeResponse'] +_UPDATEMOLECULEREQUEST = DESCRIPTOR.message_types_by_name['UpdateMoleculeRequest'] +_UPDATEMOLECULERESPONSE = DESCRIPTOR.message_types_by_name['UpdateMoleculeResponse'] +_DELETEMOLECULEREQUEST = DESCRIPTOR.message_types_by_name['DeleteMoleculeRequest'] +_DELETEMOLECULERESPONSE = DESCRIPTOR.message_types_by_name['DeleteMoleculeResponse'] +_LISTMOLECULEREQUEST = DESCRIPTOR.message_types_by_name['ListMoleculeRequest'] +_LISTMOLECULERESPONSE = DESCRIPTOR.message_types_by_name['ListMoleculeResponse'] +Molecule = _reflection.GeneratedProtocolMessageType('Molecule', (_message.Message,), { + 'DESCRIPTOR' : _MOLECULE, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.Molecule) + }) +_sym_db.RegisterMessage(Molecule) + +CreateMoleculeRequest = _reflection.GeneratedProtocolMessageType('CreateMoleculeRequest', (_message.Message,), { + 'DESCRIPTOR' : _CREATEMOLECULEREQUEST, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.CreateMoleculeRequest) + }) +_sym_db.RegisterMessage(CreateMoleculeRequest) + +CreateMoleculeResponse = _reflection.GeneratedProtocolMessageType('CreateMoleculeResponse', (_message.Message,), { + 'DESCRIPTOR' : _CREATEMOLECULERESPONSE, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.CreateMoleculeResponse) + }) +_sym_db.RegisterMessage(CreateMoleculeResponse) + +ReadMoleculeRequest = _reflection.GeneratedProtocolMessageType('ReadMoleculeRequest', (_message.Message,), { + 'DESCRIPTOR' : _READMOLECULEREQUEST, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.ReadMoleculeRequest) + }) +_sym_db.RegisterMessage(ReadMoleculeRequest) + +ReadMoleculeResponse = _reflection.GeneratedProtocolMessageType('ReadMoleculeResponse', (_message.Message,), { + 'DESCRIPTOR' : _READMOLECULERESPONSE, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.ReadMoleculeResponse) + }) +_sym_db.RegisterMessage(ReadMoleculeResponse) + +UpdateMoleculeRequest = _reflection.GeneratedProtocolMessageType('UpdateMoleculeRequest', (_message.Message,), { + 'DESCRIPTOR' : _UPDATEMOLECULEREQUEST, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.UpdateMoleculeRequest) + }) +_sym_db.RegisterMessage(UpdateMoleculeRequest) + +UpdateMoleculeResponse = _reflection.GeneratedProtocolMessageType('UpdateMoleculeResponse', (_message.Message,), { + 'DESCRIPTOR' : _UPDATEMOLECULERESPONSE, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.UpdateMoleculeResponse) + }) +_sym_db.RegisterMessage(UpdateMoleculeResponse) + +DeleteMoleculeRequest = _reflection.GeneratedProtocolMessageType('DeleteMoleculeRequest', (_message.Message,), { + 'DESCRIPTOR' : _DELETEMOLECULEREQUEST, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.DeleteMoleculeRequest) + }) +_sym_db.RegisterMessage(DeleteMoleculeRequest) + +DeleteMoleculeResponse = _reflection.GeneratedProtocolMessageType('DeleteMoleculeResponse', (_message.Message,), { + 'DESCRIPTOR' : _DELETEMOLECULERESPONSE, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.DeleteMoleculeResponse) + }) +_sym_db.RegisterMessage(DeleteMoleculeResponse) + +ListMoleculeRequest = _reflection.GeneratedProtocolMessageType('ListMoleculeRequest', (_message.Message,), { + 'DESCRIPTOR' : _LISTMOLECULEREQUEST, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.ListMoleculeRequest) + }) +_sym_db.RegisterMessage(ListMoleculeRequest) + +ListMoleculeResponse = _reflection.GeneratedProtocolMessageType('ListMoleculeResponse', (_message.Message,), { + 'DESCRIPTOR' : _LISTMOLECULERESPONSE, + '__module__' : 'molecule_pb2' + # @@protoc_insertion_point(class_scope:molecule.ListMoleculeResponse) + }) +_sym_db.RegisterMessage(ListMoleculeResponse) + +_MOLECULESERVICE = DESCRIPTOR.services_by_name['MoleculeService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + _MOLECULE._serialized_start=29 + _MOLECULE._serialized_end=1345 + _CREATEMOLECULEREQUEST._serialized_start=1347 + _CREATEMOLECULEREQUEST._serialized_end=1408 + _CREATEMOLECULERESPONSE._serialized_start=1410 + _CREATEMOLECULERESPONSE._serialized_end=1472 + _READMOLECULEREQUEST._serialized_start=1474 + _READMOLECULEREQUEST._serialized_end=1507 + _READMOLECULERESPONSE._serialized_start=1509 + _READMOLECULERESPONSE._serialized_end=1569 + _UPDATEMOLECULEREQUEST._serialized_start=1571 + _UPDATEMOLECULEREQUEST._serialized_end=1632 + _UPDATEMOLECULERESPONSE._serialized_start=1634 + _UPDATEMOLECULERESPONSE._serialized_end=1696 + _DELETEMOLECULEREQUEST._serialized_start=1698 + _DELETEMOLECULEREQUEST._serialized_end=1742 + _DELETEMOLECULERESPONSE._serialized_start=1744 + _DELETEMOLECULERESPONSE._serialized_end=1789 + _LISTMOLECULEREQUEST._serialized_start=1791 + _LISTMOLECULEREQUEST._serialized_end=1812 + _LISTMOLECULERESPONSE._serialized_start=1814 + _LISTMOLECULERESPONSE._serialized_end=1874 + _MOLECULESERVICE._serialized_start=1877 + _MOLECULESERVICE._serialized_end=2319 +# @@protoc_insertion_point(module_scope) diff --git a/gsoc2022/smilesdb/rpc_handler/molecule_pb2_grpc.py b/gsoc2022/smilesdb/rpc_handler/molecule_pb2_grpc.py new file mode 100644 index 00000000..4d78e91d --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/molecule_pb2_grpc.py @@ -0,0 +1,198 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +import molecule_pb2 as molecule__pb2 + + +class MoleculeServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.CreateMolecule = channel.unary_unary( + '/molecule.MoleculeService/CreateMolecule', + request_serializer=molecule__pb2.CreateMoleculeRequest.SerializeToString, + response_deserializer=molecule__pb2.CreateMoleculeResponse.FromString, + ) + self.ReadMolecule = channel.unary_unary( + '/molecule.MoleculeService/ReadMolecule', + request_serializer=molecule__pb2.ReadMoleculeRequest.SerializeToString, + response_deserializer=molecule__pb2.ReadMoleculeResponse.FromString, + ) + self.UpdateMolecule = channel.unary_unary( + '/molecule.MoleculeService/UpdateMolecule', + request_serializer=molecule__pb2.UpdateMoleculeRequest.SerializeToString, + response_deserializer=molecule__pb2.UpdateMoleculeResponse.FromString, + ) + self.DeleteMolecule = channel.unary_unary( + '/molecule.MoleculeService/DeleteMolecule', + request_serializer=molecule__pb2.DeleteMoleculeRequest.SerializeToString, + response_deserializer=molecule__pb2.DeleteMoleculeResponse.FromString, + ) + self.ListMolecule = channel.unary_stream( + '/molecule.MoleculeService/ListMolecule', + request_serializer=molecule__pb2.ListMoleculeRequest.SerializeToString, + response_deserializer=molecule__pb2.ListMoleculeResponse.FromString, + ) + + +class MoleculeServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def CreateMolecule(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ReadMolecule(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def UpdateMolecule(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def DeleteMolecule(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ListMolecule(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_MoleculeServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'CreateMolecule': grpc.unary_unary_rpc_method_handler( + servicer.CreateMolecule, + request_deserializer=molecule__pb2.CreateMoleculeRequest.FromString, + response_serializer=molecule__pb2.CreateMoleculeResponse.SerializeToString, + ), + 'ReadMolecule': grpc.unary_unary_rpc_method_handler( + servicer.ReadMolecule, + request_deserializer=molecule__pb2.ReadMoleculeRequest.FromString, + response_serializer=molecule__pb2.ReadMoleculeResponse.SerializeToString, + ), + 'UpdateMolecule': grpc.unary_unary_rpc_method_handler( + servicer.UpdateMolecule, + request_deserializer=molecule__pb2.UpdateMoleculeRequest.FromString, + response_serializer=molecule__pb2.UpdateMoleculeResponse.SerializeToString, + ), + 'DeleteMolecule': grpc.unary_unary_rpc_method_handler( + servicer.DeleteMolecule, + request_deserializer=molecule__pb2.DeleteMoleculeRequest.FromString, + response_serializer=molecule__pb2.DeleteMoleculeResponse.SerializeToString, + ), + 'ListMolecule': grpc.unary_stream_rpc_method_handler( + servicer.ListMolecule, + request_deserializer=molecule__pb2.ListMoleculeRequest.FromString, + response_serializer=molecule__pb2.ListMoleculeResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'molecule.MoleculeService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class MoleculeService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def CreateMolecule(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/molecule.MoleculeService/CreateMolecule', + molecule__pb2.CreateMoleculeRequest.SerializeToString, + molecule__pb2.CreateMoleculeResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def ReadMolecule(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/molecule.MoleculeService/ReadMolecule', + molecule__pb2.ReadMoleculeRequest.SerializeToString, + molecule__pb2.ReadMoleculeResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def UpdateMolecule(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/molecule.MoleculeService/UpdateMolecule', + molecule__pb2.UpdateMoleculeRequest.SerializeToString, + molecule__pb2.UpdateMoleculeResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def DeleteMolecule(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/molecule.MoleculeService/DeleteMolecule', + molecule__pb2.DeleteMoleculeRequest.SerializeToString, + molecule__pb2.DeleteMoleculeResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def ListMolecule(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/molecule.MoleculeService/ListMolecule', + molecule__pb2.ListMoleculeRequest.SerializeToString, + molecule__pb2.ListMoleculeResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/gsoc2022/smilesdb/rpc_handler/requirements.txt b/gsoc2022/smilesdb/rpc_handler/requirements.txt new file mode 100644 index 00000000..858af79e --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/requirements.txt @@ -0,0 +1,12 @@ +asgiref==3.5.2 +backports.zoneinfo==0.2.1 +Django==4.1 +django-cors-headers==3.13.0 +djangogrpcframework==0.2.1 +djangorestframework==3.13.1 +grpcio==1.48.1 +grpcio-tools==1.48.1 +protobuf==3.20.1 +pytz==2022.2.1 +six==1.16.0 +sqlparse==0.4.2 diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/__init__.py b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/__init__.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 00000000..1e63d62b Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/__init__.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/__init__.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 00000000..3696a032 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/__init__.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/settings.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/settings.cpython-38.pyc new file mode 100644 index 00000000..d3eb8522 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/settings.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/settings.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/settings.cpython-39.pyc new file mode 100644 index 00000000..8ea36b50 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/settings.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/urls.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/urls.cpython-38.pyc new file mode 100644 index 00000000..ad40dd36 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/urls.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/urls.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/urls.cpython-39.pyc new file mode 100644 index 00000000..6ea7299e Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/urls.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/wsgi.cpython-38.pyc b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/wsgi.cpython-38.pyc new file mode 100644 index 00000000..2ddd6d70 Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/wsgi.cpython-38.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/wsgi.cpython-39.pyc b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/wsgi.cpython-39.pyc new file mode 100644 index 00000000..d228350b Binary files /dev/null and b/gsoc2022/smilesdb/rpc_handler/rpc_handler/__pycache__/wsgi.cpython-39.pyc differ diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/asgi.py b/gsoc2022/smilesdb/rpc_handler/rpc_handler/asgi.py new file mode 100644 index 00000000..e00e70bf --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/rpc_handler/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for rpc_handler project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rpc_handler.settings") + +application = get_asgi_application() diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/settings.py b/gsoc2022/smilesdb/rpc_handler/rpc_handler/settings.py new file mode 100644 index 00000000..6ea275bf --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/rpc_handler/settings.py @@ -0,0 +1,118 @@ +""" +Django settings for rpc_handler project. + +Generated by 'django-admin startproject' using Django 4.1. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.1/ref/settings/ +""" + +from pathlib import Path +import os +import sys + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = "django-insecure-9&62v2ht_$daxz0x1!f7x^w^+z00(m@uzy6-1%3+1j@7i*15he" + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + +# Application definition + +INSTALLED_APPS = [ + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", + 'django_grpc_framework', + 'dataHandler', + 'corsheaders', +] + +MIDDLEWARE = [ + "django.middleware.security.SecurityMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "django.middleware.common.CommonMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "django.middleware.clickjacking.XFrameOptionsMiddleware", + 'corsheaders.middleware.CorsMiddleware', +] + +ROOT_URLCONF = "rpc_handler.urls" + +TEMPLATES = [ + { + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [], + "APP_DIRS": True, + "OPTIONS": { + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", + ], + }, + }, +] + +WSGI_APPLICATION = "rpc_handler.wsgi.application" + +# Database +# https://docs.djangoproject.com/en/4.1/ref/settings/#databases + +DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": BASE_DIR / "db.sqlite3", + } +} + +# Password validation +# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", + }, + {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", }, + {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", }, + {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", }, +] + +# Internationalization +# https://docs.djangoproject.com/en/4.1/topics/i18n/ + +LANGUAGE_CODE = "en-us" + +TIME_ZONE = "UTC" + +USE_I18N = True + +USE_TZ = True + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.1/howto/static-files/ + +STATIC_URL = "static/" + +# Default primary key field type +# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" +CORS_ALLOW_ALL_ORIGINS = True diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/urls.py b/gsoc2022/smilesdb/rpc_handler/rpc_handler/urls.py new file mode 100644 index 00000000..a47fbae0 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/rpc_handler/urls.py @@ -0,0 +1,24 @@ +"""rpc_handler URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" + + +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path("admin/", admin.site.urls), + path("api/", include('dataHandler.urls')) +] diff --git a/gsoc2022/smilesdb/rpc_handler/rpc_handler/wsgi.py b/gsoc2022/smilesdb/rpc_handler/rpc_handler/wsgi.py new file mode 100644 index 00000000..8104da38 --- /dev/null +++ b/gsoc2022/smilesdb/rpc_handler/rpc_handler/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for rpc_handler project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rpc_handler.settings") + +application = get_wsgi_application()