sentra 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sentra/sents.rb +11 -4
- data/lib/sentra/version.rb +1 -1
- data/lib/sentra.rb +19 -4
- data/tools/multithread_check.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5aae7672bc44a10bda509b23c28cfa305ba59f9
|
4
|
+
data.tar.gz: 7a14358e04931d5823e4ff24a227b404e0f01024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ad86147736ec4b9b897f1550c15534908e12204d35f5c0b986b66b1ba9dd91cbd7ab6b40f9484daa9f0a714fd3a949f2336975a8d4661a151fa148d582636ec
|
7
|
+
data.tar.gz: 3a49675508ee76ad2de61fa111577a1219e3741d7b56638917034d436f915ca2d22702f62d6546a2660afafb27dcebda61c64dad8fc3e0f4ad03ab3651a53209
|
data/lib/sentra/sents.rb
CHANGED
@@ -2,6 +2,7 @@ module Sentra
|
|
2
2
|
class ProcessingClient
|
3
3
|
def initialize
|
4
4
|
@tweet = OprData::Article.new
|
5
|
+
@queue = SemanticService::UnixSocketClient.new()
|
5
6
|
|
6
7
|
p "initializing"
|
7
8
|
end
|
@@ -18,13 +19,19 @@ module Sentra
|
|
18
19
|
def send
|
19
20
|
|
20
21
|
p 'sending'
|
21
|
-
|
22
|
-
queue.
|
22
|
+
p @tweet.content
|
23
|
+
@queue.SendText(@tweet)
|
24
|
+
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
def receive
|
23
30
|
p 'receiving'
|
24
|
-
result = queue.
|
31
|
+
result = @queue.ReceiveText()
|
25
32
|
p 'read done'
|
33
|
+
p result.content
|
26
34
|
result.getMetadata('twitter').getFacts()
|
27
|
-
|
28
35
|
end
|
29
36
|
|
30
37
|
def process_result statistics
|
data/lib/sentra/version.rb
CHANGED
data/lib/sentra.rb
CHANGED
@@ -44,7 +44,8 @@ module Sentra
|
|
44
44
|
processing_client.prepare_article query['content'],
|
45
45
|
"http://" +SecureRandom.urlsafe_base64 + ".com/" + SecureRandom.urlsafe_base64,
|
46
46
|
"Test1"
|
47
|
-
|
47
|
+
processing_client.send
|
48
|
+
response = processing_client.receive
|
48
49
|
begin
|
49
50
|
processing_client.process_result(response).to_json
|
50
51
|
rescue Exception => e
|
@@ -70,19 +71,33 @@ module Sentra
|
|
70
71
|
query = nil
|
71
72
|
end
|
72
73
|
if params['key'] and params['key'] =="QD3F7Yr2u098RfaB" and query
|
74
|
+
p query
|
73
75
|
responses = []
|
74
|
-
|
76
|
+
clients = []
|
75
77
|
query.each_with_index do |tweet, index|
|
76
78
|
begin
|
79
|
+
processing_client = Sentra::ProcessingClient.new
|
80
|
+
|
77
81
|
processing_client.prepare_article tweet['content'],
|
78
82
|
"http://" + SecureRandom.urlsafe_base64 + ".com/" + SecureRandom.urlsafe_base64,
|
79
83
|
"Test" + index.to_s
|
80
|
-
|
81
|
-
|
84
|
+
processing_client.send
|
85
|
+
clients.push processing_client
|
86
|
+
|
82
87
|
rescue
|
83
88
|
puts 'Errors with getting result from socket or queue'
|
84
89
|
end
|
85
90
|
end
|
91
|
+
clients.each do |client|
|
92
|
+
begin
|
93
|
+
|
94
|
+
response = client.receive
|
95
|
+
p response
|
96
|
+
responses.push(client.process_result(response))
|
97
|
+
rescue
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
86
101
|
begin
|
87
102
|
responses.to_json
|
88
103
|
rescue Exception => e
|
data/tools/multithread_check.rb
CHANGED
@@ -8,7 +8,7 @@ require 'sentra/rest_client'
|
|
8
8
|
require "sentra/sents"
|
9
9
|
|
10
10
|
|
11
|
-
num_threads =
|
11
|
+
num_threads = 20
|
12
12
|
host = '5.9.118.83'
|
13
13
|
namespace = 'consolidation'
|
14
14
|
|
@@ -21,7 +21,7 @@ class CheckLoad
|
|
21
21
|
def initialize id, contents
|
22
22
|
@id=id
|
23
23
|
@contents = contents
|
24
|
-
mycsv = CSV_MODULE::MyCSV.new('testdata.csv')
|
24
|
+
mycsv = CSV_MODULE::MyCSV.new('auxillary/testdata.csv')
|
25
25
|
@queries = mycsv.get_queries
|
26
26
|
end
|
27
27
|
|