diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 83a1651..a55095c 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -78,7 +78,7 @@ RUN sudo sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && ENV LANG en_US.UTF-8 -RUN echo 32 +RUN echo 37 COPY daemons/snetd_topic_kovan.json /home/top/daemons/kovan/ COPY daemons/snetd_topic_ropsten.json /home/top/daemons/ropsten/ @@ -92,7 +92,7 @@ COPY supervisor/supervisord.conf /etc/supervisor/ WORKDIR /home/top/dep - +#USER root # Can be uncommented for local docker building diff --git a/Docker/supervisor/kovand.conf b/Docker/supervisor/kovand.conf index 598e74a..589c0cd 100644 --- a/Docker/supervisor/kovand.conf +++ b/Docker/supervisor/kovand.conf @@ -3,9 +3,9 @@ logfile=/dev/null nodaemon=true [program:kovand] -command=./serve --config /home/top/daemons/kovan/snetd_topic_kovan.json -directory=/home/top/daemons/kovan/snetd -user=top +command=/home/top/daemons/kovan/snetd serve --config /home/top/daemons/kovan/snetd_topic_kovan.json +;directory=/home/top/daemons/kovan +user=root autostart=true autorestart=true stdout_logfile=/dev/stdout diff --git a/Docker/supervisor/ropstend.conf b/Docker/supervisor/ropstend.conf index 7725ad9..d874772 100644 --- a/Docker/supervisor/ropstend.conf +++ b/Docker/supervisor/ropstend.conf @@ -3,9 +3,9 @@ logfile=/dev/null nodaemon=true [program:ropstend] -command=./serve --config /home/top/daemons/ropsten/snetd_topic_ropsten.json -directory=/home/top/daemons/ropsten/snetd -user=top +command=/home/top/daemons/ropsten/snetd serve --config /home/top/daemons/ropsten/snetd_topic_ropsten.json +;directory=/home/top/daemons/ropsten +user=root autostart=true autorestart=true stdout_logfile=/dev/stdout diff --git a/snet_test_client.py b/snet_test_client.py index 74da4b4..abd6c65 100644 --- a/snet_test_client.py +++ b/snet_test_client.py @@ -115,7 +115,8 @@ def try_plsa_2(): if __name__ == '__main__': # try_plsa() - try_plsa_2() + print(sample_data_2()) + # try_plsa_2() # csv_reader() diff --git a/topic_analysis_grpc.py b/topic_analysis_grpc.py index b60c025..48c68db 100644 --- a/topic_analysis_grpc.py +++ b/topic_analysis_grpc.py @@ -47,29 +47,43 @@ def PLSA(self,request,context): param_error = False message = '' - if len(docs) < 2: - message = 'Length of docs should be at least two' - param_error =True + try : - if topic_divider < 0: - param_error = True - message = 'topic_divider parameter can not be a negative nubmer' + if len(docs) < 2: + message = 'Length of docs should be at least two' + param_error =True - if topic_divider == 0 and num_topics < 2: - param_error = True - message = 'Number of topics should be at least two' + if topic_divider < 0: + param_error = True + message = 'topic_divider parameter can not be a negative nubmer' - if maxiter < 0: - param_error = True - message = 'maxiter should be greater than zero' + if topic_divider == 0 and num_topics < 2: + param_error = True + message = 'Number of topics should be at least two' - if beta < 0 or beta > 1: - param_error = True - message = 'beta should have value of (0,1]' + if maxiter < 0: + param_error = True + message = 'maxiter should be greater than zero' + if beta < 0 or beta > 1: + param_error = True + message = 'beta should have value of (0,1]' - if param_error: - return topic_analysis_pb2.PLSAResponse(status=False, message=message) + + if param_error: + print(time.strftime("%c")) + print('Waiting for next call on port 5000.') + raise grpc.RpcError(grpc.StatusCode.UNKNOWN, message) + + + except Exception as e: + + logging.exception("message") + + print(time.strftime("%c")) + print('Waiting for next call on port 5000.') + + raise grpc.RpcError(grpc.StatusCode.UNKNOWN, str(e)) @@ -95,13 +109,10 @@ def PLSA(self,request,context): logging.exception("message") - resp = topic_analysis_pb2.PLSAResponse(status=False, message=str(e)) - - print('status:', resp.status) - print('message:', resp.message) + print(time.strftime("%c")) print('Waiting for next call on port 5000.') - return resp + raise grpc.RpcError(grpc.StatusCode.UNKNOWN, str(e)) def generate_topics_plsa(docs,unique_folder_naming,num_topics,topic_divider,maxiter,beta):