Commit 6a39e685 by Girish A Nandolkar

grpc for python client and scala server for the spark job reports done

1 parent d878752e
......@@ -105,8 +105,6 @@ object CreateSparkJobServer extends TestServerConnect{
* This method is used to get the synchronous method to get the all information of job and it will get the FINISHED job response
*/
def createJobAndGetResult(reqArgs:SparkJobRequest): Future[SparkJobResponseReply] ={
var sparkJobRes = SparkJobResponseReply(status = "",message = "")
......@@ -179,7 +177,6 @@ object CreateSparkJobServer extends TestServerConnect{
//Future.successful(sparkJobRes)
result
}
}
/*class Test extends Actor{
......@@ -187,8 +184,8 @@ object CreateSparkJobServer extends TestServerConnect{
def receive={
case s:String=> sender() ! new CreateSparkJobServer().statusRes(s)
}
}*/
}
*/
......
......@@ -10,7 +10,7 @@ channel = grpc.insecure_channel('localhost:50051')
stub = rapidorSparkReport_pb2_grpc.CreateSparkJobStub(channel)
def runSynchronus():
reqData =rapidorSparkReport_pb2.SparkJobRequest(debug="true",dbName="rapidor_realmarketing",fileName="/tmp/abc.csv",reportType="consolidated_report",instanceDbs="none",startDate="01/02/2017",endDate="15/02/2017",reportGenerateType="",tallyCompanyName="")
reqData =rapidorSparkReport_pb2.SparkJobRequest(debug="true",dbName="rapidor_realmarketing",fileName="/tmp/abc.csv",reportType="tally_invoice_entry",instanceDbs="none",startDate="01/02/2017",endDate="15/02/2017",reportGenerateType="",tallyCompanyName="")
response = stub.CreateJobAndGetResult(reqData)
print("The synchronus spark job creation and completed status\t"+response.status +"\t--->\t"+response.message)
......
......@@ -35,8 +35,8 @@
<file leaf-file-name="rapidorSparkReportPythonClient.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/grpc1/rapidorSparkReportPythonClient.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="92">
<caret line="10" column="20" lean-forward="true" selection-start-line="10" selection-start-column="20" selection-end-line="10" selection-end-column="20" />
<state relative-caret-position="138">
<caret line="6" column="34" lean-forward="true" selection-start-line="6" selection-start-column="34" selection-end-line="6" selection-end-column="34" />
<folding>
<element signature="e#1#38#0" expanded="true" />
</folding>
......@@ -383,6 +383,7 @@
</component>
<component name="ToolWindowManager">
<frame x="65" y="-4" width="1855" height="1084" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
......@@ -391,7 +392,7 @@
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3291536" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3291536" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
......@@ -587,8 +588,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/grpc1/rapidorSparkReportPythonClient.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="92">
<caret line="10" column="20" lean-forward="true" selection-start-line="10" selection-start-column="20" selection-end-line="10" selection-end-column="20" />
<state relative-caret-position="138">
<caret line="6" column="34" lean-forward="true" selection-start-line="6" selection-start-column="34" selection-end-line="6" selection-end-column="34" />
<folding>
<element signature="e#1#38#0" expanded="true" />
</folding>
......
---> go to this link
https://grpc.io/docs/quickstart/python.html
----> To set python sdk in intelij
file-> project structure -> project -> new -> python sdk -> add local -> and goto project eg:- /home/girish/mywork/grpcSparkApi/grpc-project/python_code/pythonGrpc/venv/bin/python -> oks
---> To run grpc for creating the server and client for proto
(venv) girish@girish:~/mywork/grpcSparkApi/pythonGrpc/grpc1$
(venv) girish@girish:~/mywork/grpcSparkApi/pythonGrpc/grpc1$ ls
__init__.py protos python
(venv) girish@girish:~/mywork/grpcSparkApi/pythonGrpc/grpc1$ python -m grpc_tools.protoc -I protos --python_out=. --grpc_python_out=. protos/python.proto
(venv) girish@girish:~/mywork/grpcSparkApi/pythonGrpc/grpc1$ python -m grpc_tools.protoc -I../../protos --python_out=. --grpc_python_out=. protos/python.proto
../../protos: warning: directory does not exist.
protos/python.proto: File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).
(venv) girish@girish:~/mywork/grpcSparkApi/pythonGrpc/grpc1$ python -m grpc_tools.protoc -I protos --python_out=. --grpc_python_out=. protos/python.proto
(venv) girish@girish:~/mywork/grpcSparkApi/pythonGrpc/grpc1$
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!