atomic-sidekiq 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/Dockerfile +13 -7
- data/Gemfile.lock +59 -31
- data/atomic-sidekiq.gemspec +5 -2
- data/docker-compose.yml +9 -5
- data/lib/atomic_sidekiq/in_flight_queue.rb +12 -0
- data/lib/atomic_sidekiq/web.rb +10 -1
- data/web/views/in_flight.erb +25 -14
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2e3936ff2625051b6102d8c81955b3b1cc2dd1641da22b1b4c6a620905a75d6
|
4
|
+
data.tar.gz: 95b7b83cec90170ee4f382e083a881ed414b0005a2e9e3481dd7b85788a57ae9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbcc5bc369abbf5557b085c3dcbd7aefa0e51413e4530ed2f59ed7569514706ae5671f891787cb4b06a7070653944c0e141879bf695e4760365e180cd7e98265
|
7
|
+
data.tar.gz: 6d0ee3f0031cecb1e54b88e11652a9905dc204a52d18cc16a8f4cb4dfd0c5e907277fc84bed8b082863166a6c06c662c5969c7a6683122d137911a5d06d2eee7
|
data/.travis.yml
CHANGED
@@ -3,6 +3,16 @@ sudo: false
|
|
3
3
|
cache: bundler
|
4
4
|
services:
|
5
5
|
- redis-server
|
6
|
+
addons:
|
7
|
+
chrome: stable
|
8
|
+
apt:
|
9
|
+
packages:
|
10
|
+
- chromium-chromedriver
|
11
|
+
before_script:
|
12
|
+
# include ChromeDriver in PATH
|
13
|
+
- ln --symbolic /usr/lib/chromium-browser/chromedriver "${HOME}/bin/chromedriver"
|
14
|
+
# start Chrome and listen on localhost
|
15
|
+
- google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 http://localhost &
|
6
16
|
before_install:
|
7
17
|
- gem install bundler
|
8
18
|
- gem update bundler
|
data/Dockerfile
CHANGED
@@ -1,22 +1,28 @@
|
|
1
1
|
# Choose the official Ruby 2.3.4 image as our starting point
|
2
2
|
FROM ruby:2.5.1
|
3
3
|
|
4
|
+
# Run updates
|
5
|
+
RUN apt-get update -qq && apt-get install -y build-essential locales chromedriver
|
6
|
+
|
7
|
+
ENV DEBIAN_FRONTEND noninteractive
|
8
|
+
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
|
9
|
+
locale-gen en_US.UTF-8 && \
|
10
|
+
dpkg-reconfigure locales && \
|
11
|
+
/usr/sbin/update-locale LANG=en_US.UTF-8 && \
|
12
|
+
rm -rf /var/lib/apt/lists/*
|
13
|
+
|
4
14
|
ENV LC_ALL en_US.UTF-8
|
5
15
|
|
6
|
-
# install locked bundler version (1.16.
|
7
|
-
RUN gem install bundler -v 1.16.
|
16
|
+
# install locked bundler version (1.16.4)
|
17
|
+
RUN gem install bundler -v 1.16.4
|
8
18
|
ENV BUNDLE_PATH=/bundle BUNDLE_JOBS=4
|
9
19
|
|
10
20
|
# Set up working directory
|
11
21
|
ENV APP_HOME /sidekiq-atomic
|
12
22
|
|
13
23
|
RUN mkdir $APP_HOME
|
24
|
+
ADD . $APP_HOME
|
14
25
|
|
15
26
|
WORKDIR $APP_HOME
|
16
27
|
|
17
|
-
ADD Gemfile .
|
18
|
-
ADD Gemfile.lock .
|
19
|
-
|
20
28
|
RUN bundle install
|
21
|
-
|
22
|
-
ADD . $APP_HOME
|
data/Gemfile.lock
CHANGED
@@ -7,52 +7,75 @@ PATH
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
10
12
|
ast (2.4.0)
|
11
|
-
|
13
|
+
capybara (3.1.1)
|
14
|
+
addressable
|
15
|
+
mini_mime (>= 0.1.3)
|
16
|
+
nokogiri (~> 1.8)
|
17
|
+
rack (>= 1.6.0)
|
18
|
+
rack-test (>= 0.6.3)
|
19
|
+
xpath (~> 3.0)
|
20
|
+
childprocess (0.9.0)
|
21
|
+
ffi (~> 1.0, >= 1.0.11)
|
22
|
+
codecov (0.1.14)
|
12
23
|
json
|
13
24
|
simplecov
|
14
25
|
url
|
15
|
-
|
16
|
-
|
17
|
-
daemons (1.2.6)
|
26
|
+
connection_pool (2.2.2)
|
27
|
+
daemons (1.3.1)
|
18
28
|
diff-lcs (1.3)
|
19
|
-
docile (1.3.
|
20
|
-
eventmachine (1.2.
|
29
|
+
docile (1.3.1)
|
30
|
+
eventmachine (1.2.7)
|
31
|
+
ffi (1.9.25)
|
32
|
+
jaro_winkler (1.5.1)
|
21
33
|
json (2.1.0)
|
34
|
+
mini_mime (1.0.1)
|
35
|
+
mini_portile2 (2.4.0)
|
36
|
+
nokogiri (1.9.1)
|
37
|
+
mini_portile2 (~> 2.4.0)
|
22
38
|
parallel (1.12.1)
|
23
|
-
parser (2.5.0
|
39
|
+
parser (2.5.3.0)
|
24
40
|
ast (~> 2.4.0)
|
25
|
-
powerpack (0.1.
|
26
|
-
|
27
|
-
rack
|
41
|
+
powerpack (0.1.2)
|
42
|
+
public_suffix (3.0.3)
|
43
|
+
rack (2.0.6)
|
44
|
+
rack-protection (2.0.5)
|
28
45
|
rack
|
46
|
+
rack-test (1.1.0)
|
47
|
+
rack (>= 1.0, < 3)
|
29
48
|
rainbow (3.0.0)
|
30
49
|
rake (11.3.0)
|
31
|
-
redis (4.0
|
32
|
-
rspec (3.
|
33
|
-
rspec-core (~> 3.
|
34
|
-
rspec-expectations (~> 3.
|
35
|
-
rspec-mocks (~> 3.
|
36
|
-
rspec-core (3.
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-expectations (3.
|
50
|
+
redis (4.1.0)
|
51
|
+
rspec (3.8.0)
|
52
|
+
rspec-core (~> 3.8.0)
|
53
|
+
rspec-expectations (~> 3.8.0)
|
54
|
+
rspec-mocks (~> 3.8.0)
|
55
|
+
rspec-core (3.8.0)
|
56
|
+
rspec-support (~> 3.8.0)
|
57
|
+
rspec-expectations (3.8.2)
|
39
58
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-mocks (3.
|
59
|
+
rspec-support (~> 3.8.0)
|
60
|
+
rspec-mocks (3.8.0)
|
42
61
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-support (3.
|
45
|
-
rubocop (0.
|
62
|
+
rspec-support (~> 3.8.0)
|
63
|
+
rspec-support (3.8.0)
|
64
|
+
rubocop (0.62.0)
|
65
|
+
jaro_winkler (~> 1.5.1)
|
46
66
|
parallel (~> 1.10)
|
47
|
-
parser (>= 2.5)
|
67
|
+
parser (>= 2.5, != 2.5.1.1)
|
48
68
|
powerpack (~> 0.1)
|
49
69
|
rainbow (>= 2.2.2, < 4.0)
|
50
70
|
ruby-progressbar (~> 1.7)
|
51
|
-
unicode-display_width (~> 1.
|
52
|
-
ruby-progressbar (1.
|
53
|
-
|
54
|
-
|
55
|
-
|
71
|
+
unicode-display_width (~> 1.4.0)
|
72
|
+
ruby-progressbar (1.10.0)
|
73
|
+
rubyzip (1.2.2)
|
74
|
+
selenium-webdriver (3.141.0)
|
75
|
+
childprocess (~> 0.5)
|
76
|
+
rubyzip (~> 1.2, >= 1.2.2)
|
77
|
+
sidekiq (5.2.3)
|
78
|
+
connection_pool (~> 2.2, >= 2.2.2)
|
56
79
|
rack-protection (>= 1.5.0)
|
57
80
|
redis (>= 3.3.5, < 5)
|
58
81
|
simplecov (0.16.1)
|
@@ -65,8 +88,10 @@ GEM
|
|
65
88
|
eventmachine (~> 1.0, >= 1.0.4)
|
66
89
|
rack (>= 1, < 3)
|
67
90
|
timecop (0.9.1)
|
68
|
-
unicode-display_width (1.
|
91
|
+
unicode-display_width (1.4.1)
|
69
92
|
url (0.3.2)
|
93
|
+
xpath (3.1.0)
|
94
|
+
nokogiri (~> 1.8)
|
70
95
|
|
71
96
|
PLATFORMS
|
72
97
|
ruby
|
@@ -74,12 +99,15 @@ PLATFORMS
|
|
74
99
|
DEPENDENCIES
|
75
100
|
atomic-sidekiq!
|
76
101
|
bundler (~> 1.12)
|
102
|
+
capybara (~> 3.1.1)
|
77
103
|
codecov
|
78
104
|
rake (~> 11.3)
|
79
105
|
rspec
|
80
106
|
rubocop
|
107
|
+
selenium-webdriver
|
81
108
|
thin
|
82
109
|
timecop
|
110
|
+
xpath (~> 3.1.0)
|
83
111
|
|
84
112
|
BUNDLED WITH
|
85
|
-
1.16.
|
113
|
+
1.16.6
|
data/atomic-sidekiq.gemspec
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "atomic-sidekiq"
|
5
|
-
s.version = "1.
|
6
|
-
s.date = "
|
5
|
+
s.version = "1.3.0"
|
6
|
+
s.date = "2019-01-03"
|
7
7
|
s.summary = "Reliable fetcher for Sidekiq"
|
8
8
|
s.description = "Reliable fetcher for Sidekiq"
|
9
9
|
s.homepage = "https://github.com/Colex/atomic-sidekiq"
|
@@ -22,6 +22,9 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency "timecop", "~> 0.9"
|
23
23
|
s.add_development_dependency "codecov", ">= 0.1.10"
|
24
24
|
s.add_development_dependency "thin"
|
25
|
+
s.add_development_dependency "capybara", "~> 3.1.1"
|
26
|
+
s.add_development_dependency "xpath", "~> 3.1.0"
|
27
|
+
s.add_development_dependency "selenium-webdriver"
|
25
28
|
|
26
29
|
s.add_runtime_dependency "sidekiq", "~> 5.0"
|
27
30
|
end
|
data/docker-compose.yml
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
version: '2'
|
2
2
|
|
3
3
|
services:
|
4
|
-
|
4
|
+
base:
|
5
5
|
build: .
|
6
|
-
command: bin/test
|
7
6
|
env_file:
|
8
7
|
- docker.env
|
8
|
+
volumes:
|
9
|
+
- .:/sidekiq-atomic
|
10
|
+
image: sidekiq-atomic
|
11
|
+
|
12
|
+
test:
|
13
|
+
extends:
|
14
|
+
service: base
|
15
|
+
command: bin/test
|
9
16
|
depends_on:
|
10
17
|
- redis
|
11
18
|
ports:
|
12
19
|
- 3000:3000
|
13
|
-
volumes:
|
14
|
-
- .:/sidekiq-atomic
|
15
|
-
image: sidekiq-atomic
|
16
20
|
volumes_from:
|
17
21
|
- bundle
|
18
22
|
|
@@ -9,6 +9,14 @@ module AtomicSidekiq
|
|
9
9
|
retrieve_jobs(keys)
|
10
10
|
end
|
11
11
|
|
12
|
+
def delete_job(jid)
|
13
|
+
job_matcher = keymaker.job_matcher(jid)
|
14
|
+
job_keys = retrieve_keys(job_matcher)
|
15
|
+
return 0 if job_keys.empty?
|
16
|
+
|
17
|
+
Sidekiq.redis { |conn| conn.del(*job_keys) }
|
18
|
+
end
|
19
|
+
|
12
20
|
private
|
13
21
|
|
14
22
|
attr_reader :keymaker
|
@@ -31,5 +39,9 @@ module AtomicSidekiq
|
|
31
39
|
keys.map { |key| JSON.parse(conn.get(key)) }
|
32
40
|
end
|
33
41
|
end
|
42
|
+
|
43
|
+
def retrieve_keys(key_wildcard)
|
44
|
+
Sidekiq.redis { |conn| conn.keys(key_wildcard) }
|
45
|
+
end
|
34
46
|
end
|
35
47
|
end
|
data/lib/atomic_sidekiq/web.rb
CHANGED
@@ -4,6 +4,7 @@ module AtomicSidekiq
|
|
4
4
|
|
5
5
|
def self.registered(app)
|
6
6
|
register_inflight(app)
|
7
|
+
register_delete_inflight(app)
|
7
8
|
register_recovered(app)
|
8
9
|
end
|
9
10
|
|
@@ -16,12 +17,20 @@ module AtomicSidekiq
|
|
16
17
|
|
17
18
|
start_idx = (@current_page - 1) * @count
|
18
19
|
end_idx = (@current_page * @count) - 1
|
19
|
-
@jobs = @jobs[start_idx..end_idx]
|
20
|
+
@jobs = @jobs[start_idx..end_idx] || []
|
20
21
|
|
21
22
|
erb File.read(File.join(VIEW_PATH, "in_flight.erb"))
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
26
|
+
def self.register_delete_inflight(app)
|
27
|
+
app.post "/in-flight/:jid/delete" do
|
28
|
+
AtomicSidekiq::InFlightQueue.new.delete_job(route_params[:jid])
|
29
|
+
|
30
|
+
redirect "#{root_path}in-flight"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
25
34
|
def self.register_recovered(app)
|
26
35
|
app.get "/recovered" do
|
27
36
|
@queues = AtomicSidekiq::RecoveredStats.new.stats_by_queue
|
data/web/views/in_flight.erb
CHANGED
@@ -8,37 +8,48 @@
|
|
8
8
|
</header>
|
9
9
|
|
10
10
|
<div class="table_container">
|
11
|
-
<table class="inflight table table-hover table-bordered table-striped table-white">
|
11
|
+
<table id="inflight-stats" class="inflight table table-hover table-bordered table-striped table-white">
|
12
12
|
<thead>
|
13
13
|
<th><%= t("Total In-flight") %></th>
|
14
14
|
<th><%= t("Estimated Lost") %></th>
|
15
15
|
</thead>
|
16
|
+
<tbody>
|
16
17
|
<tr>
|
17
18
|
<td><%= number_with_delimiter(@total_size) %> </td>
|
18
19
|
<td><%= number_with_delimiter(@total_size - workers.size) %> </td>
|
19
20
|
</tr>
|
21
|
+
</tbody>
|
20
22
|
</table>
|
21
23
|
</div>
|
22
24
|
|
23
25
|
<div class="table_container">
|
24
|
-
<table class="inflight table table-hover table-bordered table-striped table-white">
|
26
|
+
<table id="inflight-jobs" class="inflight table table-hover table-bordered table-striped table-white">
|
25
27
|
<thead>
|
26
28
|
<th><%= t("Job") %></th>
|
27
29
|
<th><%= t("Args") %></th>
|
28
30
|
<th><%= t("Queue") %></th>
|
29
31
|
<th><%= t("Expires at") %></th>
|
32
|
+
<th><%= t("Actions") %></th>
|
30
33
|
</thead>
|
31
|
-
|
32
|
-
|
33
|
-
<
|
34
|
-
|
35
|
-
|
36
|
-
<
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
34
|
+
<tbody>
|
35
|
+
<% @jobs.each do |job| %>
|
36
|
+
<tr>
|
37
|
+
<td><%= h job["class"] %> </td>
|
38
|
+
<td><%= h job["args"] %> </td>
|
39
|
+
<td>
|
40
|
+
<a href="<%= root_path %>queues/<%= CGI.escape(job["queue"]) %>"><%= h job["queue"] %></a>
|
41
|
+
</td>
|
42
|
+
<td>
|
43
|
+
<%= relative_time(Time.at(job["expire_at"])) %>
|
44
|
+
</td>
|
45
|
+
<td>
|
46
|
+
<form action="<%= root_path %>in-flight/<%= CGI.escape(job["jid"]) %>/delete" method="post">
|
47
|
+
<%= csrf_tag if respond_to?(:csrf_tag) %>
|
48
|
+
<input id="jid-<%= job["jid"] %>" class='btn btn-xs btn-danger pull-left' type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('Are you sure?', :jid => job["jid"]) %>"/>
|
49
|
+
</form>
|
50
|
+
</td>
|
51
|
+
</tr>
|
52
|
+
<% end %>
|
53
|
+
</tbody>
|
43
54
|
</table>
|
44
55
|
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atomic-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Correia Santos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,48 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: capybara
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.1.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.1.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: xpath
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 3.1.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 3.1.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: selenium-webdriver
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
111
153
|
- !ruby/object:Gem::Dependency
|
112
154
|
name: sidekiq
|
113
155
|
requirement: !ruby/object:Gem::Requirement
|