teplohod 0.0.1.alpha2 → 0.0.1.alpha3
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/example/main.rb +4 -4
- data/lib/teplohod/initializers/redis.rb +1 -1
- data/lib/teplohod/pipeline/base.rb +15 -11
- data/lib/teplohod/queue/base.rb +1 -1
- data/lib/teplohod/version.rb +1 -1
- data/lib/teplohod.rb +1 -1
- data/web/views/index.erb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02b20cf89ccfba79b9a3c57a5fa0ba88d4de0ed6
|
4
|
+
data.tar.gz: 637fed28c8bed5b9bdc43cb118fb69bb56043fe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
14
|
+
'Initial Pipeline'
|
15
15
|
end
|
16
16
|
|
17
17
|
def desription
|
18
|
-
|
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
|
-
|
37
|
+
'Result Pipeline'
|
38
38
|
end
|
39
39
|
|
40
40
|
def result
|
41
|
-
|
41
|
+
'Result data there'
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -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
|
-
|
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
|
-
|
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
|
-
|
42
|
+
break unless @loop
|
43
43
|
sleep timeout
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
def name
|
49
|
+
"#{self.class}#name is not implemented"
|
50
|
+
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
def description
|
53
|
+
"#{self.class}#description is not implemented"
|
54
|
+
end
|
55
55
|
|
56
|
-
|
56
|
+
protected
|
57
57
|
|
58
58
|
def process(data)
|
59
59
|
result = processor.process data
|
60
60
|
log { logger.info { "processed #{data}" } }
|
61
|
-
|
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
|
|
data/lib/teplohod/queue/base.rb
CHANGED
data/lib/teplohod/version.rb
CHANGED
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-
|
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-
|
37
|
-
<dl>
|
38
|
-
<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.
|
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-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|