teplohod 0.0.1.alpha2 → 0.0.1.alpha3

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: ce565fd4bd697219906170915fd5ec50abd6f30d
4
- data.tar.gz: b08b2c74494d28daf08fbfcf0da3f89359adf1bd
3
+ metadata.gz: 02b20cf89ccfba79b9a3c57a5fa0ba88d4de0ed6
4
+ data.tar.gz: 637fed28c8bed5b9bdc43cb118fb69bb56043fe2
5
5
  SHA512:
6
- metadata.gz: 774446c79a77688003689e373b7a9ac2aa456a89793daf0358d8fabc5e0bac309195b08e3858d5b8a373c4ca616e1a70a68b601eb09d44e499e4715379883c19
7
- data.tar.gz: 9d61b225ae05c82223e93326f79f28063bb4ac1180294ea9d35e5ecdcd0dce65b20791f5de6cbd8aaba43cdbd69d7e7fee609d7be28ffc2d861f361d7d4b76b8
6
+ metadata.gz: 24dc45563a19cb4d0ea7b435a3b6ca122708ccdc276e0504d8c0383af5d4b1af55bd81b3af2a7fb770f54f7e89bc9b0aaa3d75b60d190b21b70d955e7eedbc78
7
+ data.tar.gz: efef86e6d3f80aadd7f9295b2ed0c9b8eb53854d5903d4dee7121adf10325d5c548b9f387d0ea84130049c0c43de06129c510be1ab2859c5cfed3945a955e438
data/example/main.rb CHANGED
@@ -11,11 +11,11 @@ class InitialPipeline < Teplohod::Pipeline::Base
11
11
  self.queue = StartQueue.new
12
12
 
13
13
  def name
14
- "Initial Pipeline"
14
+ 'Initial Pipeline'
15
15
  end
16
16
 
17
17
  def desription
18
- "Initial data there"
18
+ 'Initial data there'
19
19
  end
20
20
 
21
21
  def on_empty_load
@@ -34,11 +34,11 @@ class ResultPipeline < Teplohod::Pipeline::Base
34
34
  self.queue = ResultQueue.new
35
35
 
36
36
  def name
37
- "Result Pipeline"
37
+ 'Result Pipeline'
38
38
  end
39
39
 
40
40
  def result
41
- "Result data there"
41
+ 'Result data there'
42
42
  end
43
43
  end
44
44
 
@@ -7,7 +7,7 @@ module Teplohod
7
7
 
8
8
  def run
9
9
  # TODO: add configuration
10
- Teplohod.redis= ::Redis.new
10
+ Teplohod.redis = ::Redis.new
11
11
  end
12
12
  end
13
13
  end
@@ -11,7 +11,7 @@ module Teplohod
11
11
  def initialize(key: self.class.to_s.underscore, timeout: 5, loop: true)
12
12
  @key = key
13
13
  @timeout = timeout
14
- @loop = loop
14
+ @loop = loop
15
15
  end
16
16
 
17
17
  def parent
@@ -35,30 +35,30 @@ module Teplohod
35
35
  loop do
36
36
  while element = parent.queue.pop
37
37
  queue.push process(element)
38
- Teplohod::Stats.increment(:processed_jobs, self)
38
+ Teplohod::Stats.increment(:processed_jobs, self)
39
39
  end
40
40
  log { logger.warn { "parent queue is clear, sleep #{timeout} sec"} }
41
41
  parent.on_finish
42
- break unless @loop
42
+ break unless @loop
43
43
  sleep timeout
44
44
  end
45
45
  end
46
46
  end
47
47
 
48
- def name
49
- "#{self.class}#name is not implemented"
50
- end
48
+ def name
49
+ "#{self.class}#name is not implemented"
50
+ end
51
51
 
52
- def description
53
- "#{self.class}#description is not implemented"
54
- end
52
+ def description
53
+ "#{self.class}#description is not implemented"
54
+ end
55
55
 
56
- protected
56
+ protected
57
57
 
58
58
  def process(data)
59
59
  result = processor.process data
60
60
  log { logger.info { "processed #{data}" } }
61
- result
61
+ result
62
62
  end
63
63
 
64
64
  def on_finish
@@ -68,6 +68,10 @@ module Teplohod
68
68
  def on_empty_load
69
69
  log { logger.warn { '#on_empty_load does nothing' } }
70
70
  end
71
+
72
+ def on_init_load
73
+ log { logger.warn { '#on_init_load does nothing' } }
74
+ end
71
75
 
72
76
  private
73
77
 
@@ -17,7 +17,7 @@ module Teplohod
17
17
  length.zero?
18
18
  end
19
19
 
20
- def last(count)
20
+ def last(_count)
21
21
  raise NotImplementedError
22
22
  end
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Teplohod
2
- VERSION = '0.0.1.alpha2'.freeze
2
+ VERSION = '0.0.1.alpha3'.freeze
3
3
  end
data/lib/teplohod.rb CHANGED
@@ -45,7 +45,7 @@ module Teplohod
45
45
  Teplohod::Logging.logger = log
46
46
  end
47
47
 
48
- # TODO add configuartion from options
48
+ # TODO: add configuartion from options
49
49
  def redis=(redis)
50
50
  @redis ||= ConnectionPool.new(options) { Redis::Namespace.new(REDIS_NAMESPACE, redis: redis) }
51
51
  end
data/web/views/index.erb CHANGED
@@ -25,19 +25,19 @@
25
25
  <%= pipeline.description %>
26
26
  </p>
27
27
  </div>
28
- <div class="column-1-3">
28
+ <div class="column-1-4">
29
29
  <dl>
30
- <dt>Processed:</dt>
30
+ <dt>Processed from parent queue:</dt>
31
31
  <dd><%= stats[:processed] || 0%></dd>
32
32
  <dt>Items in queue:</dt>
33
33
  <dd><%= pipeline.queue.length %></dd>
34
34
  </dl>
35
35
  </div>
36
- <div class="column-1-3">
37
- <dl>
38
- <dt>Top 5 from queue:</dt>
36
+ <div class="column-5-12">
37
+ <dl style="word-wrap: break-word;">
38
+ <dt>Last 5 from queue:</dt>
39
39
  <% pipeline.queue.last(5).each do |data| %>
40
- <dd><%= data %></dd>
40
+ <dd><%= data.except("_id", "id") %></dd>
41
41
  <% end %>
42
42
  </dl>
43
43
  </div>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teplohod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha2
4
+ version: 0.0.1.alpha3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Kuchmistov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-25 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra