sentra 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c193f60f03deb274a90ec981273219fdc163dd1
4
- data.tar.gz: f339043744f90bda9610f2352f30edb96003ec34
3
+ metadata.gz: f5aae7672bc44a10bda509b23c28cfa305ba59f9
4
+ data.tar.gz: 7a14358e04931d5823e4ff24a227b404e0f01024
5
5
  SHA512:
6
- metadata.gz: 98e897c0e10ec07563fca736e742e66c3355e0064eff1c992babc639dc28a0953c1b17a0dead795b42734d2f436d15accdc0a8930d90306db7791a1abd0f5ceb
7
- data.tar.gz: 2095052828d840c40ef4b9edaa88ec504f229a58dfe9e90f475f383213c8d15337579437240eca2f4d8f2414802e1ba5f14069b8ac3d72088bac40f95e9a9373
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
- queue = SemanticService::UnixSocketClient.new()
22
- queue.writeArticle(@tweet)
22
+ p @tweet.content
23
+ @queue.SendText(@tweet)
24
+
25
+
26
+ end
27
+
28
+
29
+ def receive
23
30
  p 'receiving'
24
- result = queue.readArticle()
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
@@ -1,3 +1,3 @@
1
1
  module Sentra
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
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
- response = processing_client.send
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
- processing_client = Sentra::ProcessingClient.new
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
- response = processing_client.send
81
- responses.push(processing_client.process_result(response))
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
@@ -8,7 +8,7 @@ require 'sentra/rest_client'
8
8
  require "sentra/sents"
9
9
 
10
10
 
11
- num_threads = 100
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kshakirov