You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2022/09/12 17:16:32 UTC
[airavata-sandbox] 07/26: refactor client
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 3174daebd5f8f93f4f33efacf498018cf0835607
Author: Bhavesh Asanabada <as...@gmail.com>
AuthorDate: Mon Jul 4 06:20:34 2022 +0530
refactor client
---
.../__pycache__/calc_info_pb2.cpython-38.pyc | Bin 1629 -> 0 bytes
.../__pycache__/calc_info_pb2_grpc.cpython-38.pyc | Bin 4098 -> 0 bytes
gsoc2022/smilesdb/smiles_client/calc_info_pb2.py | 47 ------
.../smilesdb/smiles_client/calc_info_pb2_grpc.py | 165 ---------------------
gsoc2022/smilesdb/smiles_client/main.py | 56 -------
.../smilesdb/smiles_client/proto/calc_info.proto | 40 -----
6 files changed, 308 deletions(-)
diff --git a/gsoc2022/smilesdb/smiles_client/__pycache__/calc_info_pb2.cpython-38.pyc b/gsoc2022/smilesdb/smiles_client/__pycache__/calc_info_pb2.cpython-38.pyc
deleted file mode 100644
index 7d70f051..00000000
Binary files a/gsoc2022/smilesdb/smiles_client/__pycache__/calc_info_pb2.cpython-38.pyc and /dev/null differ
diff --git a/gsoc2022/smilesdb/smiles_client/__pycache__/calc_info_pb2_grpc.cpython-38.pyc b/gsoc2022/smilesdb/smiles_client/__pycache__/calc_info_pb2_grpc.cpython-38.pyc
deleted file mode 100644
index 3776d2a0..00000000
Binary files a/gsoc2022/smilesdb/smiles_client/__pycache__/calc_info_pb2_grpc.cpython-38.pyc and /dev/null differ
diff --git a/gsoc2022/smilesdb/smiles_client/calc_info_pb2.py b/gsoc2022/smilesdb/smiles_client/calc_info_pb2.py
deleted file mode 100644
index 37a1074a..00000000
--- a/gsoc2022/smilesdb/smiles_client/calc_info_pb2.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- 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\ncom.smiles\"u\n\x08\x43\x61lcInfo\x12\x0e\n\x06nbasis\x18\x01 \x01(\x03\x12\x0b\n\x03nmo\x18\x02 \x01(\x03\x12\x0e\n\x06nalpha\x18\x03 \x01(\x03\x12\r\n\x05nbeta\x18\x04 \x01(\x03\x12\r\n\x05natom\x18\x05 \x01(\x03\x12\x0e\n\x06\x65nergy\x18\x06 \x01(\x01\x12\x0e\n\x06SMILES\x18\x07 \x01(\t\"P\n\x0f\x43\x61lcInfoRequest\x12\x15\n\rcalcInfoQuery\x18\x01 \x01(\t\x12&\n\x08\x63\x61lcInfo\x18\x02 \x0 [...]
-
-
-
-_CALCINFO = DESCRIPTOR.message_types_by_name['CalcInfo']
-_CALCINFOREQUEST = DESCRIPTOR.message_types_by_name['CalcInfoRequest']
-CalcInfo = _reflection.GeneratedProtocolMessageType('CalcInfo', (_message.Message,), {
- 'DESCRIPTOR' : _CALCINFO,
- '__module__' : 'calc_info_pb2'
- # @@protoc_insertion_point(class_scope:com.smiles.CalcInfo)
- })
-_sym_db.RegisterMessage(CalcInfo)
-
-CalcInfoRequest = _reflection.GeneratedProtocolMessageType('CalcInfoRequest', (_message.Message,), {
- 'DESCRIPTOR' : _CALCINFOREQUEST,
- '__module__' : 'calc_info_pb2'
- # @@protoc_insertion_point(class_scope:com.smiles.CalcInfoRequest)
- })
-_sym_db.RegisterMessage(CalcInfoRequest)
-
-_CALCINFOSERVICE = DESCRIPTOR.services_by_name['CalcInfoService']
-if _descriptor._USE_C_DESCRIPTORS == False:
-
- DESCRIPTOR._options = None
- _CALCINFO._serialized_start=31
- _CALCINFO._serialized_end=148
- _CALCINFOREQUEST._serialized_start=150
- _CALCINFOREQUEST._serialized_end=230
- _CALCINFOSERVICE._serialized_start=233
- _CALCINFOSERVICE._serialized_end=531
-# @@protoc_insertion_point(module_scope)
diff --git a/gsoc2022/smilesdb/smiles_client/calc_info_pb2_grpc.py b/gsoc2022/smilesdb/smiles_client/calc_info_pb2_grpc.py
deleted file mode 100644
index dcb4a1b5..00000000
--- a/gsoc2022/smilesdb/smiles_client/calc_info_pb2_grpc.py
+++ /dev/null
@@ -1,165 +0,0 @@
-# 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.GetCalcInfo = channel.unary_unary(
- '/com.smiles.CalcInfoService/GetCalcInfo',
- request_serializer=calc__info__pb2.CalcInfoRequest.SerializeToString,
- response_deserializer=calc__info__pb2.CalcInfo.FromString,
- )
- self.CreateCalcInfo = channel.unary_unary(
- '/com.smiles.CalcInfoService/CreateCalcInfo',
- request_serializer=calc__info__pb2.CalcInfoRequest.SerializeToString,
- response_deserializer=calc__info__pb2.CalcInfo.FromString,
- )
- self.UpdateCalcInfo = channel.unary_unary(
- '/com.smiles.CalcInfoService/UpdateCalcInfo',
- request_serializer=calc__info__pb2.CalcInfoRequest.SerializeToString,
- response_deserializer=calc__info__pb2.CalcInfo.FromString,
- )
- self.DeleteCalcInfo = channel.unary_unary(
- '/com.smiles.CalcInfoService/DeleteCalcInfo',
- request_serializer=calc__info__pb2.CalcInfoRequest.SerializeToString,
- response_deserializer=calc__info__pb2.CalcInfo.FromString,
- )
-
-
-class CalcInfoServiceServicer(object):
- """Missing associated documentation comment in .proto file."""
-
- def GetCalcInfo(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 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 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 add_CalcInfoServiceServicer_to_server(servicer, server):
- rpc_method_handlers = {
- 'GetCalcInfo': grpc.unary_unary_rpc_method_handler(
- servicer.GetCalcInfo,
- request_deserializer=calc__info__pb2.CalcInfoRequest.FromString,
- response_serializer=calc__info__pb2.CalcInfo.SerializeToString,
- ),
- 'CreateCalcInfo': grpc.unary_unary_rpc_method_handler(
- servicer.CreateCalcInfo,
- request_deserializer=calc__info__pb2.CalcInfoRequest.FromString,
- response_serializer=calc__info__pb2.CalcInfo.SerializeToString,
- ),
- 'UpdateCalcInfo': grpc.unary_unary_rpc_method_handler(
- servicer.UpdateCalcInfo,
- request_deserializer=calc__info__pb2.CalcInfoRequest.FromString,
- response_serializer=calc__info__pb2.CalcInfo.SerializeToString,
- ),
- 'DeleteCalcInfo': grpc.unary_unary_rpc_method_handler(
- servicer.DeleteCalcInfo,
- request_deserializer=calc__info__pb2.CalcInfoRequest.FromString,
- response_serializer=calc__info__pb2.CalcInfo.SerializeToString,
- ),
- }
- generic_handler = grpc.method_handlers_generic_handler(
- 'com.smiles.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 GetCalcInfo(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, '/com.smiles.CalcInfoService/GetCalcInfo',
- calc__info__pb2.CalcInfoRequest.SerializeToString,
- calc__info__pb2.CalcInfo.FromString,
- options, channel_credentials,
- insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
-
- @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, '/com.smiles.CalcInfoService/CreateCalcInfo',
- calc__info__pb2.CalcInfoRequest.SerializeToString,
- calc__info__pb2.CalcInfo.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, '/com.smiles.CalcInfoService/UpdateCalcInfo',
- calc__info__pb2.CalcInfoRequest.SerializeToString,
- calc__info__pb2.CalcInfo.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, '/com.smiles.CalcInfoService/DeleteCalcInfo',
- calc__info__pb2.CalcInfoRequest.SerializeToString,
- calc__info__pb2.CalcInfo.FromString,
- options, channel_credentials,
- insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
diff --git a/gsoc2022/smilesdb/smiles_client/main.py b/gsoc2022/smilesdb/smiles_client/main.py
deleted file mode 100644
index 1a492636..00000000
--- a/gsoc2022/smilesdb/smiles_client/main.py
+++ /dev/null
@@ -1,56 +0,0 @@
-import logging
-
-import grpc
-import calc_info_pb2
-import calc_info_pb2_grpc
-
-
-def ceateCalcInfo(channel):
- stub = calc_info_pb2_grpc.CalcInfoServiceStub(channel)
- response = stub.CreateCalcInfo(calc_info_pb2.CalcInfoRequest(calcInfoQuery="SAVE",
- calcInfo=calc_info_pb2.CalcInfo(nbasis=1002, nmo=1002,
- nalpha=1001,
- nbeta=1001, natom=1001,
- energy=1001,
- SMILES="TEST1001")))
- print(response)
- return
-
-
-def updateCalcInfo(channel):
- stub = calc_info_pb2_grpc.CalcInfoServiceStub(channel)
- response = stub.UpdateCalcInfo(calc_info_pb2.CalcInfoRequest(calcInfoQuery="UPD",
- calcInfo=calc_info_pb2.CalcInfo(nbasis=1001, nmo=1002,
- nalpha=1001,
- nbeta=1001, natom=1001,
- energy=1001,
- SMILES="TEST1001")))
- print(response)
- return
-
-
-def deleteCalcInfo(channel):
- stub = calc_info_pb2_grpc.CalcInfoServiceStub(channel)
- response = stub.DeleteCalcInfo(calc_info_pb2.CalcInfoRequest(calcInfoQuery="DEL",
- calcInfo=calc_info_pb2.CalcInfo(nbasis=1001, nmo=1003,
- nalpha=1001,
- nbeta=1001, natom=1001,
- energy=1001,
- SMILES="TEST1001")))
- print(response)
- return
-
-
-def run():
- # NOTE(gRPC Python Team): .close() is possible on a channel and should be
- # used in circumstances in which the with statement does not fit the needs
- # of the code.
- with grpc.insecure_channel('localhost:7594') as channel:
- # ceateCalcInfo(channel)
- # updateCalcInfo(channel)
- # uncomment below line to run delete
- deleteCalcInfo(channel)
-
-
-if __name__ == '__main__':
- run()
diff --git a/gsoc2022/smilesdb/smiles_client/proto/calc_info.proto b/gsoc2022/smilesdb/smiles_client/proto/calc_info.proto
deleted file mode 100644
index ab8acff2..00000000
--- a/gsoc2022/smilesdb/smiles_client/proto/calc_info.proto
+++ /dev/null
@@ -1,40 +0,0 @@
-syntax = "proto3";
-
-package com.smiles;
-
-message CalcInfo{
- //QcSchema-Properties_Info
- int64 nbasis = 1; // The number of basis functions for the computation. number
- int64 nmo = 2; // The number of molecular orbitals for the computation. number
- int64 nalpha = 3;// The number of alpha electrons in the computation. number
- int64 nbeta = 4;// The number of beta electrons in the computation. number
- int64 natom = 5; // The number of atoms in the computation. number
- double energy = 6;// The energy of the requested method, identical to return_value for energy computations. number
- string SMILES =7;
-}
-
-message CalcInfoRequest {
- string calcInfoQuery=1;
- CalcInfo calcInfo=2;
-}
-
-service CalcInfoService {
- rpc GetCalcInfo(CalcInfoRequest) returns (CalcInfo) {}
- rpc CreateCalcInfo(CalcInfoRequest) returns (CalcInfo){}
- rpc UpdateCalcInfo(CalcInfoRequest) returns (CalcInfo){}
- rpc DeleteCalcInfo(CalcInfoRequest) returns (CalcInfo){}
-}
-
-
-
-//python -m grpc_tools.protoc -I ./proto --python_out=. --grpc_python_out=. ./proto/calc_info.proto
-
-
-
-
-
-
-
-
-
-