From 15c567b62ab484d56f200aa3903b4f3f38e42439 Mon Sep 17 00:00:00 2001 From: Eyob Yirdaw Date: Mon, 25 Feb 2019 18:55:52 +0300 Subject: [PATCH] added configs for mainnet --- Docker/Dockerfile | 10 ++++++++-- Docker/supervisor/mainnetd.conf | 20 ++++++++++++++++++++ docs/tests/test_doc_2.txt | 19 +++++++++++++++++++ plsa-service/plsa/example_plsa.py | 5 +++++ snet_test_client.py | 10 +++++----- 5 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 Docker/supervisor/mainnetd.conf create mode 100644 docs/tests/test_doc_2.txt diff --git a/Docker/Dockerfile b/Docker/Dockerfile index a55095c..1c79a50 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -44,6 +44,7 @@ RUN sudo pip install -r requirements_2.txt RUN sudo mkdir /var/log/kovand/ \ /var/log/ropstend/ \ + /var/log/mainnetd/ \ /var/log/topic_grpc/ \ /var/log/topic_rest/ @@ -51,9 +52,11 @@ RUN mkdir /home/top/pay/ \ /home/top/daemons/ \ /home/top/pay/kovan/ \ /home/top/pay/ropsten/ \ + /home/top/pay/mainnet/ \ /home/top/gunicorn/ \ /home/top/daemons/kovan/ \ /home/top/daemons/ropsten/ \ + /home/top/daemons/mainnet/ \ /home/top/dep/ \ /home/top/dep/appData/ \ /home/top/dep/appData/plsa/ \ @@ -63,12 +66,13 @@ RUN mkdir /home/top/pay/ \ /home/top/dep/appData/plsa/plsa-parameters -ENV DAEMON_VERSION 0.1.6 +ENV DAEMON_VERSION 0.1.7 RUN wget -O snet-daemon.tar.gz https://github.com/singnet/snet-daemon/releases/download/v$DAEMON_VERSION/snet-daemon-v$DAEMON_VERSION-linux-amd64.tar.gz && \ tar --strip-components=1 -xzf snet-daemon.tar.gz && \ cp snetd /home/top/daemons/kovan/ && \ - cp snetd /home/top/daemons/ropsten/ + cp snetd /home/top/daemons/ropsten/ && \ + cp snetd /home/top/daemons/mainnet/ RUN sudo apt-get update && DEBIAN_FRONTEND=noninteractive sudo apt-get install -y locales @@ -82,9 +86,11 @@ RUN echo 37 COPY daemons/snetd_topic_kovan.json /home/top/daemons/kovan/ COPY daemons/snetd_topic_ropsten.json /home/top/daemons/ropsten/ +COPY daemons/snetd_topic_mainnet.json /home/top/daemons/mainnet/ COPY gunicorn/config.py /home/top/gunicorn/ COPY supervisor/kovand.conf /etc/supervisor/conf.d/ COPY supervisor/ropstend.conf /etc/supervisor/conf.d/ +COPY supervisor/mainnet.conf /etc/supervisor/conf.d/ COPY supervisor/topic_grpc.conf /etc/supervisor/conf.d/ COPY supervisor/topic_rest.conf /etc/supervisor/conf.d/ COPY supervisor/supervisord.conf /etc/supervisor/ diff --git a/Docker/supervisor/mainnetd.conf b/Docker/supervisor/mainnetd.conf new file mode 100644 index 0000000..2418171 --- /dev/null +++ b/Docker/supervisor/mainnetd.conf @@ -0,0 +1,20 @@ +[supervisord] +logfile=/dev/null +nodaemon=true + +[program:mainnetd] +command=/home/top/daemons/mainnet/snetd serve --config /home/top/daemons/mainnet/snetd_topic_mainnet.json +;directory=/home/top/daemons/mainnet +user=root +autostart=true +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +redirect_stderr=true +;stderr_logfile=/var/log/mainnet/err.log +;stdout_logfile=/var/log/mainnet/out.log +;redirect_stderr=true +;stdout_logfile_maxbytes=10MB +;stdout_logfile_backups=100 +;stderr_logfile_maxbytes=10MB +;stderr_logfile_backups=100 diff --git a/docs/tests/test_doc_2.txt b/docs/tests/test_doc_2.txt new file mode 100644 index 0000000..7caed67 --- /dev/null +++ b/docs/tests/test_doc_2.txt @@ -0,0 +1,19 @@ +Toward Democratic, Lawful Citizenship for AIs, Robots, and Corporations + +Dr. Ben Goertzel, CEO of SingularityNET, shares his thoughts about the AI Citizenship Test + +I am writing this on a plane flying away from Malta, where I just spoke about SingularityNET at the Malta Blockchain Summit. + +It was my first time on Malta, and after the event, I took the afternoon to explore some of the elegant, quaint, ancient neighborhoods of the island. + +Walking through medieval alleyways by the rocky coast, I felt an ironic contrast between my elegant surroundings and the main reason I had decided to allocate a couple days from my insanely busy schedule to this Malta event: not just the conference itself, but also the opportunity to meet with the top levels of the Malta government to discuss the enablement of Maltese citizenship for AIs, robots and automated corporations. + +The folks who had built the stone walls lining the narrow Maltese roads, still standing strong centuries later, had probably not foreseen their blue-wave-lapped island becoming a nexus of thinking at the intersection of general intelligence theory, cryptography, distributed systems, and advanced legal theory. + +The Hanson Robot Sophia, with whose development I've been intimately involved via my role as Chief Scientist of Hanson Robotics, was granted citizenship of Saudi Arabia this year. This was an exciting landmark event, however, its significance is muddled a bit by the fact that Saudi Arabia is not governed by rule of law in the modern sense. + +In a nation governed by rule of law, citizenship has a clearly defined meaning with rights and responsibilities relatively straightforwardly derivable from written legal documents using modern analytical logic (admittedly with some measure of quasi-subjective interpretation via case law). + +Saudi Arabian citizenship also has a real meaning, but it's a different sort of meaning — derivable from various historical Islamic writings (the Quran, the hadiths, etc.) based on deep contextual interpretation by modern and historical Islamic figures. This is a species of legal interpretation that is understood rather poorly by myself personally, and one that is less easily comprehensible by current AIs. + +I'm aware that affiliation with Saudi Arabia in any sense has become controversial in recent weeks due to the apparent murder of Jamal Khashoggi. diff --git a/plsa-service/plsa/example_plsa.py b/plsa-service/plsa/example_plsa.py index 0688056..bc5fd86 100644 --- a/plsa-service/plsa/example_plsa.py +++ b/plsa-service/plsa/example_plsa.py @@ -358,6 +358,11 @@ def train(data,empty_docs_list,json_files_list,maxiter=500, debug=True): word_by_topic_conditional = open(PATH_word_by_topic_conditional+'.csv', "w") + global num_topics_generated + if len(plsa.p_w_z) < 300: + num_topics_generated = len(plsa.p_w_z) + + p_w_z_transposed_truncated = np.sort(plsa.p_w_z.transpose()[:,0:num_topics_generated]) for i in range(p_w_z_transposed_truncated.__len__()): diff --git a/snet_test_client.py b/snet_test_client.py index abd6c65..7072279 100644 --- a/snet_test_client.py +++ b/snet_test_client.py @@ -32,7 +32,7 @@ def sample_data(): def sample_data_2(): - path = str(pathlib.Path(os.path.abspath('')).parents[0])+'/topic-analysis/docs/tests/test_doc.txt' + path = str(pathlib.Path(os.path.abspath('')).parents[0])+'/topic-analysis/docs/tests/test_doc_2.txt' docs = [] @@ -90,8 +90,8 @@ def try_plsa(): def try_plsa_2(): - # channel = grpc.insecure_channel('localhost:5000') - channel = grpc.insecure_channel('172.17.1.53:5001') + channel = grpc.insecure_channel('localhost:5000') + # channel = grpc.insecure_channel('172.17.1.53:5001') # channel = grpc.insecure_channel('172.17.0.75:5001') stub = topic_analysis_pb2_grpc.TopicAnalysisStub(channel) @@ -115,8 +115,8 @@ def try_plsa_2(): if __name__ == '__main__': # try_plsa() - print(sample_data_2()) - # try_plsa_2() + # print(sample_data_2()) + try_plsa_2() # csv_reader()