sidekiq-job-manager 0.1.4 → 0.1.6

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: d9fddda82d4a833d65313eaeda1ff37e96c6a5a5
4
- data.tar.gz: 89562e7830dcdc36659bbec7bd79a4f84da05efb
3
+ metadata.gz: 54ed5a24fc812962a576a9bb431b7d653746c512
4
+ data.tar.gz: 4d54d32c9a18c265099f0370fa3a2ee392341e2a
5
5
  SHA512:
6
- metadata.gz: 3261f98e63f365f641e5da7d7d2225569eb97db461498aff48599f59508c42331fd44391fa7fd1555ee5625be7bebce773ad7e1c5564f24885d72c783218ceeb
7
- data.tar.gz: 1ffbbe45f14e14c6948129710baf692d36baae4b61883e420b78ffeff5dbad33c378db0ef63e3a645b5847976e4aa6d7ef32c53717ba69ef46d04bbdb4129425
6
+ metadata.gz: ac0c6495d46fe7fe93191d701b53331cb8fca2a0df08f15155c08801cc153eee3d8009c5f0de26668eb6f727ebdde54393398deb53f686ce895fa179a3a896b3
7
+ data.tar.gz: 553145760176ac0702caa9173d95a5753f978afd992e99d013018ef71d99277a4a2070887746098995e1e6439e44118552dab366572cdcba488ea06ee50f78dc
@@ -7,47 +7,50 @@ PATH
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- celluloid (0.14.1)
11
- timers (>= 1.0.0)
10
+ celluloid (0.15.2)
11
+ timers (~> 1.1.0)
12
12
  connection_pool (1.1.0)
13
- hike (1.2.1)
13
+ hike (1.2.3)
14
14
  json (1.8.0)
15
- multi_json (1.7.3)
16
- rack (1.4.1)
17
- rack-protection (1.2.0)
15
+ mock_redis (0.9.0)
16
+ multi_json (1.8.1)
17
+ rack (1.5.2)
18
+ rack-protection (1.5.0)
18
19
  rack
19
20
  rack-test (0.6.2)
20
21
  rack (>= 1.0)
21
- rake (0.9.2.2)
22
- redis (3.0.4)
22
+ rake (10.1.0)
23
+ redis (3.0.5)
23
24
  redis-namespace (1.3.1)
24
25
  redis (~> 3.0.0)
25
- sidekiq (2.13.1)
26
- celluloid (>= 0.14.1)
26
+ sidekiq (2.15.1)
27
+ celluloid (>= 0.15.1)
27
28
  connection_pool (>= 1.0.0)
28
29
  json
29
- redis (>= 3.0)
30
- redis-namespace
31
- sinatra (1.3.3)
32
- rack (~> 1.3, >= 1.3.6)
33
- rack-protection (~> 1.2)
34
- tilt (~> 1.3, >= 1.3.3)
35
- slim (1.3.4)
36
- temple (~> 0.5.5)
37
- tilt (~> 1.3.3)
38
- sprockets (2.8.1)
30
+ redis (>= 3.0.4)
31
+ redis-namespace (>= 1.3.1)
32
+ sinatra (1.4.3)
33
+ rack (~> 1.4)
34
+ rack-protection (~> 1.4)
35
+ tilt (~> 1.3, >= 1.3.4)
36
+ slim (2.0.1)
37
+ temple (~> 0.6.6)
38
+ tilt (>= 1.3.3, < 2.1)
39
+ sprockets (2.10.0)
39
40
  hike (~> 1.2)
40
41
  multi_json (~> 1.0)
41
42
  rack (~> 1.0)
42
43
  tilt (~> 1.1, != 1.3.0)
43
- temple (0.5.5)
44
- tilt (1.3.3)
44
+ temple (0.6.7)
45
+ tilt (1.4.1)
45
46
  timers (1.1.0)
46
47
 
47
48
  PLATFORMS
48
49
  ruby
49
50
 
50
51
  DEPENDENCIES
52
+ connection_pool
53
+ mock_redis
51
54
  rack-test
52
55
  rake
53
56
  sidekiq-job-manager!
data/config.ru CHANGED
@@ -4,9 +4,10 @@
4
4
  #
5
5
  require 'sidekiq'
6
6
  require 'sidekiq/web'
7
- require './lib/sidekiq-manager'
7
+ require './lib/sidekiq-job-manager'
8
+ require 'mock_redis'
8
9
 
9
- REDIS = Sidekiq::RedisConnection.create(:url => "redis://localhost/15", :namespace => 'sidekiq_manager_test')
10
+ REDIS = ConnectionPool.new(:size => 1, :timeout => 5) { MockRedis.new }
10
11
  Sidekiq.redis = REDIS
11
12
  Sidekiq.redis {|c| c.flushdb }
12
13
 
@@ -34,4 +35,4 @@ Sidekiq.redis {|c| c.flushdb }
34
35
  end
35
36
  end
36
37
 
37
- run Sidekiq::Web
38
+ run Sidekiq::Web
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module JobManager
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
@@ -0,0 +1,85 @@
1
+ <header class="col-sm-12">
2
+ <div class="col-sm-5">
3
+ <h3>Last calls of <%=@worker%> worker</h3>
4
+ </div>
5
+ <div class="col-sm-3"">
6
+ <input class="filter" type="search" style="margin: 12px 0;margin-top: 18px;" placeholder="Filter" />
7
+ </div>
8
+ <div class="col-sm-2"">
9
+ <% if @messages.size > 0 %>
10
+ <%= erb :_paging, :locals => { :url => "#{root_path}manager/worker/#{@worker}#@name" } %>
11
+ <% end %>
12
+ </div>
13
+ </header>
14
+
15
+ <% if @messages.size > 0 %>
16
+ <table class="table table-striped table-bordered table-white" style="width: 100%; margin: 0; table-layout:fixed;">
17
+ <thead>
18
+ <th style="width: 25%">Payload</th>
19
+ <th style="width: 10%">Queue</th>
20
+ <th style="width: 15%">Finished At</th>
21
+ <th style="width: 38%">Exception</th>
22
+ <th style="width: 12%">Action</th>
23
+ </thead>
24
+ <% @messages.each do |msg| %>
25
+ <tr class="<%=msg['error'].nil? ? '' : 'error'%>">
26
+ <td style="overflow: hidden; text-overflow: ellipsis;">
27
+ <%= msg['payload'] %>
28
+ </td>
29
+ <td><%= msg['queue'] %>
30
+ <td>
31
+ <time datetime="<%=Time.parse(msg['finished_at']).getutc.iso8601%>">
32
+ <%= msg['finished_at'] %>
33
+ </time>
34
+ </td>
35
+ <td style="overflow: auto; padding: 10px;">
36
+ <% if msg['error'] %>
37
+ <a class="backtrace" href="#" onclick="$(this).next().toggle(); return false" = "<%=msg['error']['exception']%>: <%=msg['error']['error']%>"
38
+ <pre style="display: none; background: none; border: 0; width: 100%; max-height: 30em; font-size: 0.8em; white-space: nowrap;"><%= msg['error']['backtrace'].join("<br />") %>
39
+ </pre>
40
+ <% end %>
41
+ </td>
42
+ <td>
43
+ <input class="btn btn-small add-to-queue" type="button" name="run" value="Add to queue" data-args="<%=msg['payload']['args'].join(',')%>" data-worker="<%=@worker%>" data-queue="<%=msg['queue']%>" />
44
+ </td>
45
+ </tr>
46
+ <% end %>
47
+ </table>
48
+
49
+ <div class="row">
50
+ <div class="span5">
51
+ <div class="form form-inline" action="<%=root_path%>manager/worker/<%=@worker%>/remove" method="post" style="margin: 20px 0">
52
+ <input class="btn btn-danger btn-small" type="submit" name="delete" value="Clear All" />
53
+ </div>
54
+ </div>
55
+ <div class="span4" />
56
+ <%= erb :_paging, :locals => { :url => "#{root_path}manager/worker/#{@worker}#@name" } %>
57
+ </div>
58
+ </div>
59
+ <% else %>
60
+ <div class="alert alert-success">No recent jobs found.</div>
61
+ <% end %>
62
+
63
+ <script type="text/javascript">
64
+ $('input.filter').live('keyup', function() {
65
+ var rex = new RegExp($(this).val(), 'i');
66
+ $('.table-striped tbody tr').hide();
67
+ $('.table-striped tbody tr').filter(function() {
68
+ return rex.test($(this).text());
69
+ }).show();
70
+ });
71
+
72
+ $('input.add-to-queue').live('click', function(){
73
+ var params = {
74
+ args: prompt('Enter arguments, comma separated', $(this).data('args')),
75
+ worker: $(this).data('worker'),
76
+ queue: $(this).data('queue')
77
+ }
78
+
79
+ if (params['args'] != undefined) {
80
+ $.post('<%=root_path%>manager/add_to_queue', params, function(data) {
81
+ window.location = "<%=root_path%>queues/"+params['queue']
82
+ });
83
+ }
84
+ })
85
+ </script>
@@ -0,0 +1,47 @@
1
+ <header class="row">
2
+ <div class="span5">
3
+ <h3>Recent Jobs</h3>
4
+ </div>
5
+ </header>
6
+
7
+ <% if @jobs.length > 0 %>
8
+ <table class="table table-striped table-bordered table-white" style="width: 100%; margin: 0; table-layout:fixed;">
9
+ <thead>
10
+ <th style="width: 44%">Worker</th>
11
+ <th style="width: 44%">Last run</th>
12
+ <th style="widht: 12%">Action</th>
13
+ </thead>
14
+ <% @jobs.each do |job| %>
15
+ <tr class="<%=job[:last_call]['error'].nil? ? '' : 'error'%>">
16
+ <td style="overflow: hidden; text-overflow: ellipsis;">
17
+ <a href="<%=root_path%>manager/worker/<%=job[:name]%>">
18
+ <%= job[:name] %>
19
+ </a>
20
+ <td>
21
+ <time datetime="<%=Time.parse(job[:last_call]['finished_at']).getutc.iso8601%>">
22
+ <%= job[:last_call]['finished_at'] %>
23
+ </time>
24
+ </td>
25
+ <td>
26
+ <input class="btn btn-small add-to-queue" type="button" name="run" value="Add to queue" data-worker="<%=job[:name]%>" data-queue="<%=job[:last_call]['queue']%>" />
27
+ </td>
28
+ </tr>
29
+ <% end %>
30
+ </table>
31
+ <% else %>
32
+ <div class="alert alert-success">No recent jobs found</div>
33
+ <% end %>
34
+
35
+ <script type="text/javascript">
36
+ $('input.add-to-queue').live('click', function(){
37
+ var params = {
38
+ args: prompt('Enter arguments, comma separated', $(this).data('args')),
39
+ worker: $(this).data('worker'),
40
+ queue: $(this).data('queue')
41
+ }
42
+
43
+ $.post('<%=root_path%>manager/add_to_queue', params, function(data) {
44
+ window.location = "<%=root_path%>queues/"+params['queue']
45
+ });
46
+ })
47
+ </script>
@@ -1,3 +1,5 @@
1
+ require 'slim'
2
+
1
3
  module Sidekiq
2
4
  module JobManager
3
5
  module WebExtension
@@ -17,7 +19,7 @@ module Sidekiq
17
19
  }
18
20
  end
19
21
 
20
- render(:slim, File.read(File.join(view_path, "manager.slim")))
22
+ render(:erb, File.read(File.join(view_path, "manager.erb")))
21
23
  end
22
24
 
23
25
  app.get "/manager/worker/:name" do |name|
@@ -28,7 +30,7 @@ module Sidekiq
28
30
  (@current_page, @total_size, @messages) = page("#{name}:details", params[:page], @count)
29
31
  @messages = @messages.map { |msg| Sidekiq.load_json(msg) }
30
32
 
31
- render(:slim, File.read(File.join(view_path, "job_details.slim")))
33
+ render(:erb, File.read(File.join(view_path, "job_details.erb")))
32
34
  end
33
35
 
34
36
  app.post "/manager/worker/:name/remove" do |name|
@@ -22,4 +22,6 @@ Gem::Specification.new do |gem|
22
22
  gem.add_development_dependency "sprockets"
23
23
  gem.add_development_dependency "sinatra"
24
24
  gem.add_development_dependency "slim"
25
+ gem.add_development_dependency "connection_pool"
26
+ gem.add_development_dependency "mock_redis"
25
27
  end
@@ -16,12 +16,13 @@ require "rack/test"
16
16
 
17
17
  require "celluloid"
18
18
  require "sidekiq"
19
- require "sidekiq-manager"
19
+ require "sidekiq-job-manager"
20
20
  require "sidekiq/processor"
21
21
  require "sidekiq/fetch"
22
22
  require "sidekiq/cli"
23
+ require "mock_redis"
23
24
 
24
25
  Celluloid.logger = nil
25
26
  Sidekiq.logger.level = Logger::ERROR
26
27
 
27
- REDIS = Sidekiq::RedisConnection.create(:url => "redis://localhost/15", :namespace => 'sidekiq_manager_test')
28
+ REDIS = ConnectionPool.new(:size => 1, :timeout => 5) { MockRedis.new }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-job-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Bugaev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-19 00:00:00.000000000 Z
11
+ date: 2013-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: connection_pool
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: mock_redis
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  description: Manage your sidekiq jobs
98
126
  email:
99
127
  - leonsbox@gmail.com
@@ -114,8 +142,8 @@ files:
114
142
  - lib/sidekiq/job-manager.rb
115
143
  - lib/sidekiq/job-manager/middleware.rb
116
144
  - lib/sidekiq/job-manager/version.rb
117
- - lib/sidekiq/job-manager/views/job_details.slim
118
- - lib/sidekiq/job-manager/views/manager.slim
145
+ - lib/sidekiq/job-manager/views/job_details.erb
146
+ - lib/sidekiq/job-manager/views/manager.erb
119
147
  - lib/sidekiq/job-manager/web_extension.rb
120
148
  - sidekiq-job-manager.gemspec
121
149
  - test/middleware_test.rb
@@ -1,63 +0,0 @@
1
- header.row
2
- .span5
3
- h3 Last calls of #{@worker} worker
4
- .span3
5
- input.filter type="search" style="margin: 12px 0;margin-top: 18px;" placeholder="Filter"
6
- .span2
7
- - if @messages.size > 0
8
- == slim :_paging, :locals => { :url => "#{root_path}manager/worker/#{@worker}#@name" }
9
-
10
- - if @messages.size > 0
11
- table class="table table-striped table-bordered table-white" style="width: 100%; margin: 0; table-layout:fixed;"
12
- thead
13
- th style="width: 25%" Payload
14
- th style="width: 10%" Queue
15
- th style="width: 15%" Finished At
16
- th style="width: 38%" Exception
17
- th style="width: 12%" Action
18
- - @messages.each do |msg|
19
- tr class="#{msg['error'].nil? ? '' : 'error'}"
20
- td style="overflow: hidden; text-overflow: ellipsis;"
21
- = msg['payload']
22
- td= msg['queue']
23
- td
24
- time datetime="#{Time.parse(msg['finished_at']).getutc.iso8601}"
25
- = msg['finished_at']
26
- td style="overflow: auto; padding: 10px;"
27
- - if msg['error']
28
- a.backtrace href="#" onclick="$(this).next().toggle(); return false" = "#{msg['error']['exception']}: #{msg['error']['error']}"
29
- pre style="display: none; background: none; border: 0; width: 100%; max-height: 30em; font-size: 0.8em; white-space: nowrap;" == msg['error']['backtrace'].join("<br />")
30
- td
31
- input.btn.btn-small.add-to-queue type="button" name="run" value="Add to queue" data-args="#{msg['payload']['args'].join(',')}" data-worker="#{@worker}" data-queue="#{msg['queue']}"
32
-
33
- div.row
34
- .span5
35
- form.form-inline action="#{root_path}manager/worker/#{@worker}/remove" method="post" style="margin: 20px 0"
36
- input.btn.btn-danger.btn-small type="submit" name="delete" value="Clear All"
37
- .span4
38
- == slim :_paging, :locals => { :url => "#{root_path}manager/worker/#{@worker}#@name" }
39
- - else
40
- .alert.alert-success No recent jobs found.
41
-
42
- javascript:
43
- $('input.filter').live('keyup', function() {
44
- var rex = new RegExp($(this).val(), 'i');
45
- $('.table-striped tbody tr').hide();
46
- $('.table-striped tbody tr').filter(function() {
47
- return rex.test($(this).text());
48
- }).show();
49
- });
50
-
51
- $('input.add-to-queue').live('click', function(){
52
- var params = {
53
- args: prompt('Enter arguments, comma separated', $(this).data('args')),
54
- worker: $(this).data('worker'),
55
- queue: $(this).data('queue')
56
- }
57
-
58
- if (params['args'] != undefined) {
59
- $.post('#{root_path}manager/add_to_queue', params, function(data) {
60
- window.location = "#{root_path}queues/"+params['queue']
61
- });
62
- }
63
- })
@@ -1,36 +0,0 @@
1
- header.row
2
- .span5
3
- h3 Recent Jobs
4
-
5
- - if @jobs.length > 0
6
- table class="table table-striped table-bordered table-white" style="width: 100%; margin: 0; table-layout:fixed;"
7
- thead
8
- th style="width: 44%" Worker
9
- th style="width: 44%" Last run
10
- th style="widht: 12%" Action
11
- - @jobs.each do |job|
12
- tr class="#{job[:last_call]['error'].nil? ? '' : 'error'}"
13
- td style="overflow: hidden; text-overflow: ellipsis;"
14
- a href="#{root_path}manager/worker/#{job[:name]}"
15
- = job[:name]
16
- td
17
- time datetime="#{Time.parse(job[:last_call]['finished_at']).getutc.iso8601}"
18
- = job[:last_call]['finished_at']
19
-
20
- td
21
- input.btn.btn-small.add-to-queue type="button" name="run" value="Add to queue" data-worker="#{job[:name]}" data-queue="#{job[:last_call]['queue']}"
22
- - else
23
- .alert.alert-success No recent jobs found.
24
-
25
- javascript:
26
- $('input.add-to-queue').live('click', function(){
27
- var params = {
28
- args: prompt('Enter arguments, comma separated', $(this).data('args')),
29
- worker: $(this).data('worker'),
30
- queue: $(this).data('queue')
31
- }
32
-
33
- $.post('#{root_path}manager/add_to_queue', params, function(data) {
34
- window.location = "#{root_path}queues/"+params['queue']
35
- });
36
- })