qless 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4d96d36c55d04e6bb3287f32c3bc03f168d602ed
4
+ data.tar.gz: 1f3bfe923ac481a1d3b8c53eb33ea2709ac7b650
5
+ SHA512:
6
+ metadata.gz: e5574d01d86fa501ee6e80e9cb6c73013b67065a23d8a9ee019c099f5273f837d8cd354152d79fc8645674cc50ed3d82ce037a2eebf4d74200ff5dee043b1185
7
+ data.tar.gz: 78199f3f81d6f768375ae2769edfd0bea29b47ff2648263781d2d2a6e0c1246624e911fd0cd5a9d789960d2fd87bb173daba739c48e2458c179f2f33dc3004df
data/Gemfile CHANGED
@@ -9,8 +9,16 @@ end
9
9
 
10
10
  group :development do
11
11
  gem 'byebug', :platforms => [:ruby_20, :ruby_21]
12
+ gem 'cane', :platforms => [:ruby_20, :ruby_21]
13
+ gem 'poltergeist', '~> 1.0.0'
12
14
  gem 'pry'
13
15
  gem 'pry-byebug', :platforms => [:ruby_20, :ruby_21]
14
16
  gem 'pry-stack_explorer'
15
- gem 'cane', :platforms => [:ruby_20, :ruby_21]
17
+ gem 'rake'
18
+ gem 'rspec'
19
+ gem 'rspec-fire'
20
+ gem 'rubocop'
21
+ gem 'simplecov'
22
+ gem 'thin'
23
+ gem 'timecop'
16
24
  end
data/exe/qless-config ADDED
@@ -0,0 +1,45 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'json'
4
+ require 'qless'
5
+ require 'thor'
6
+
7
+ class Configurator < Thor
8
+
9
+ class_option :redis, :default => 'redis://localhost:6379/0'
10
+
11
+ no_commands do
12
+ def qless
13
+ if @qless.nil?
14
+ @qless = Qless::Client.new(url: options[:redis])
15
+ end
16
+ @qless
17
+ end
18
+ end
19
+
20
+ desc 'dump', 'Get config and print to stdout'
21
+ def dump
22
+ puts JSON.pretty_generate(qless.config.all)
23
+ end
24
+
25
+ desc 'load <filename> [--clear]', 'Set config from a file and command-line args'
26
+ option :clear, :type => :boolean, :default => false
27
+ def load(filename)
28
+ File.open(filename) do |file|
29
+ values = JSON.load(file)
30
+
31
+ if options[:clear]
32
+ (qless.config.all.keys - values.keys).each do |key|
33
+ qless.config.clear(key)
34
+ end
35
+ end
36
+
37
+ values.each do |key, value|
38
+ qless.config[key] = value
39
+ end
40
+ end
41
+ end
42
+
43
+ end
44
+
45
+ Configurator.start(ARGV)
data/lib/qless/job.rb CHANGED
@@ -160,7 +160,7 @@ module Qless
160
160
  end
161
161
 
162
162
  def description
163
- "#{@klass_name} (#{@jid} / #{@queue_name} / #{@state})"
163
+ "#{@klass_name} (#{@jid} / #{@queue_name} / #{@state} / #{@data})"
164
164
  end
165
165
 
166
166
  def inspect
data/lib/qless/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Encoding: utf-8
2
2
 
3
3
  module Qless
4
- VERSION = '0.10.0'
4
+ VERSION = '0.10.1'
5
5
  end
@@ -110,6 +110,7 @@ module Qless
110
110
 
111
111
  # Actually perform the job
112
112
  def perform(job)
113
+ start_time = Time.now.to_f
113
114
  around_perform(job)
114
115
  rescue JobLockLost
115
116
  log(:warn, "Lost lock for job #{job.jid}")
@@ -117,6 +118,9 @@ module Qless
117
118
  fail_job(job, error, caller)
118
119
  else
119
120
  try_complete(job)
121
+ ensure
122
+ elapsed_time = Time.now.to_f - start_time
123
+ log(:info, "Job #{job.description} took #{elapsed_time} seconds")
120
124
  end
121
125
 
122
126
  # Allow middleware modules to be mixed in and override the
@@ -150,7 +154,7 @@ module Qless
150
154
  @paused = false
151
155
  end
152
156
 
153
- # Set the proceline. Not supported on all systems
157
+ # Set the procline. Not supported on all systems
154
158
  def procline(value, in_signal_handler=true)
155
159
  $0 = "Qless-#{Qless::VERSION}: #{value} at #{Time.now.iso8601}"
156
160
  log(:debug, $PROGRAM_NAME) unless in_signal_handler
@@ -168,7 +172,7 @@ module Qless
168
172
  #
169
173
  # We don't want to (or are able to) fail the job with this error in
170
174
  # any of these cases, so the best we can do is log the failure.
171
- log(:error, "Failed to complete #{job.inspect}: #{e.message}")
175
+ log(:warn, "Failed to complete #{job.inspect}: #{e.message}")
172
176
  end
173
177
 
174
178
  def fail_job(job, error, worker_backtrace)
@@ -119,7 +119,7 @@ module Qless
119
119
  # Wait for any child to kick the bucket
120
120
  pid, status = Process.wait2
121
121
  code, sig = status.exitstatus, status.stopsig
122
- log(:warn,
122
+ log((code == 0 ? :info : :warn),
123
123
  "Worker process #{pid} died with #{code} from signal (#{sig})")
124
124
 
125
125
  # allow our shutdown logic (called from a separate thread) to take affect.
@@ -225,7 +225,7 @@ module Qless
225
225
  cpid = fork_child_process
226
226
 
227
227
  # If we're the parent process, ave information about the child
228
- log(:warn, "Spawned worker #{cpid} to replace #{pid}")
228
+ log(:info, "Spawned worker #{cpid} to replace #{pid}")
229
229
  @sandboxes[cpid] = slot
230
230
  end
231
231
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
5
- prerelease:
4
+ version: 0.10.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dan Lecocq
@@ -10,281 +9,107 @@ authors:
10
9
  autorequire:
11
10
  bindir: exe
12
11
  cert_chain: []
13
- date: 2016-02-02 00:00:00.000000000 Z
12
+ date: 2016-03-31 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
- name: redis
15
+ name: metriks
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - "~>"
21
19
  - !ruby/object:Gem::Version
22
- version: '2.2'
20
+ version: '0.9'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ! '>='
29
- - !ruby/object:Gem::Version
30
- version: '2.2'
31
- - !ruby/object:Gem::Dependency
32
- name: sinatra
33
- requirement: !ruby/object:Gem::Requirement
34
- none: false
35
- requirements:
36
- - - ~>
37
- - !ruby/object:Gem::Version
38
- version: 1.3.2
39
- type: :development
40
- prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ~>
45
- - !ruby/object:Gem::Version
46
- version: 1.3.2
47
- - !ruby/object:Gem::Dependency
48
- name: vegas
49
- requirement: !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: 0.1.11
55
- type: :development
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ~>
61
- - !ruby/object:Gem::Version
62
- version: 0.1.11
63
- - !ruby/object:Gem::Dependency
64
- name: rspec
65
- requirement: !ruby/object:Gem::Requirement
66
- none: false
67
- requirements:
68
- - - ~>
69
- - !ruby/object:Gem::Version
70
- version: '2.12'
71
- type: :development
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ~>
77
- - !ruby/object:Gem::Version
78
- version: '2.12'
79
- - !ruby/object:Gem::Dependency
80
- name: rspec-fire
81
- requirement: !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ~>
85
- - !ruby/object:Gem::Version
86
- version: '1.1'
87
- type: :development
88
- prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ~>
93
- - !ruby/object:Gem::Version
94
- version: '1.1'
95
- - !ruby/object:Gem::Dependency
96
- name: rake
97
- requirement: !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
100
- - - ~>
101
- - !ruby/object:Gem::Version
102
- version: '10.0'
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
- requirements:
108
- - - ~>
109
- - !ruby/object:Gem::Version
110
- version: '10.0'
111
- - !ruby/object:Gem::Dependency
112
- name: capybara
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ~>
117
- - !ruby/object:Gem::Version
118
- version: 1.1.2
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ~>
125
- - !ruby/object:Gem::Version
126
- version: 1.1.2
127
- - !ruby/object:Gem::Dependency
128
- name: poltergeist
129
- requirement: !ruby/object:Gem::Requirement
130
- none: false
131
- requirements:
132
- - - ~>
133
- - !ruby/object:Gem::Version
134
- version: 1.0.0
135
- type: :development
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
140
- - - ~>
141
- - !ruby/object:Gem::Version
142
- version: 1.0.0
143
- - !ruby/object:Gem::Dependency
144
- name: faye-websocket
145
- requirement: !ruby/object:Gem::Requirement
146
- none: false
147
- requirements:
148
- - - ~>
149
- - !ruby/object:Gem::Version
150
- version: 0.4.0
151
- type: :development
152
- prerelease: false
153
- version_requirements: !ruby/object:Gem::Requirement
154
- none: false
155
- requirements:
156
- - - ~>
157
- - !ruby/object:Gem::Version
158
- version: 0.4.0
159
- - !ruby/object:Gem::Dependency
160
- name: launchy
161
- requirement: !ruby/object:Gem::Requirement
162
- none: false
163
- requirements:
164
- - - ~>
165
- - !ruby/object:Gem::Version
166
- version: 2.1.0
167
- type: :development
168
- prerelease: false
169
- version_requirements: !ruby/object:Gem::Requirement
170
- none: false
171
24
  requirements:
172
- - - ~>
25
+ - - "~>"
173
26
  - !ruby/object:Gem::Version
174
- version: 2.1.0
27
+ version: '0.9'
175
28
  - !ruby/object:Gem::Dependency
176
- name: simplecov
29
+ name: redis
177
30
  requirement: !ruby/object:Gem::Requirement
178
- none: false
179
31
  requirements:
180
- - - ~>
32
+ - - ">="
181
33
  - !ruby/object:Gem::Version
182
- version: 0.7.1
183
- type: :development
34
+ version: '2.2'
35
+ type: :runtime
184
36
  prerelease: false
185
37
  version_requirements: !ruby/object:Gem::Requirement
186
- none: false
187
38
  requirements:
188
- - - ~>
39
+ - - ">="
189
40
  - !ruby/object:Gem::Version
190
- version: 0.7.1
41
+ version: '2.2'
191
42
  - !ruby/object:Gem::Dependency
192
43
  name: sentry-raven
193
44
  requirement: !ruby/object:Gem::Requirement
194
- none: false
195
45
  requirements:
196
- - - ~>
46
+ - - "~>"
197
47
  - !ruby/object:Gem::Version
198
48
  version: '0.4'
199
- type: :development
49
+ type: :runtime
200
50
  prerelease: false
201
51
  version_requirements: !ruby/object:Gem::Requirement
202
- none: false
203
52
  requirements:
204
- - - ~>
53
+ - - "~>"
205
54
  - !ruby/object:Gem::Version
206
55
  version: '0.4'
207
56
  - !ruby/object:Gem::Dependency
208
- name: metriks
57
+ name: sinatra
209
58
  requirement: !ruby/object:Gem::Requirement
210
- none: false
211
59
  requirements:
212
- - - ~>
60
+ - - "~>"
213
61
  - !ruby/object:Gem::Version
214
- version: '0.9'
215
- type: :development
62
+ version: 1.3.2
63
+ type: :runtime
216
64
  prerelease: false
217
65
  version_requirements: !ruby/object:Gem::Requirement
218
- none: false
219
66
  requirements:
220
- - - ~>
67
+ - - "~>"
221
68
  - !ruby/object:Gem::Version
222
- version: '0.9'
69
+ version: 1.3.2
223
70
  - !ruby/object:Gem::Dependency
224
- name: rubocop
71
+ name: vegas
225
72
  requirement: !ruby/object:Gem::Requirement
226
- none: false
227
73
  requirements:
228
- - - ~>
74
+ - - "~>"
229
75
  - !ruby/object:Gem::Version
230
- version: 0.13.1
231
- type: :development
76
+ version: 0.1.11
77
+ type: :runtime
232
78
  prerelease: false
233
79
  version_requirements: !ruby/object:Gem::Requirement
234
- none: false
235
80
  requirements:
236
- - - ~>
81
+ - - "~>"
237
82
  - !ruby/object:Gem::Version
238
- version: 0.13.1
83
+ version: 0.1.11
239
84
  - !ruby/object:Gem::Dependency
240
85
  name: rusage
241
86
  requirement: !ruby/object:Gem::Requirement
242
- none: false
243
87
  requirements:
244
- - - ~>
88
+ - - "~>"
245
89
  - !ruby/object:Gem::Version
246
90
  version: 0.2.0
247
- type: :development
91
+ type: :runtime
248
92
  prerelease: false
249
93
  version_requirements: !ruby/object:Gem::Requirement
250
- none: false
251
94
  requirements:
252
- - - ~>
95
+ - - "~>"
253
96
  - !ruby/object:Gem::Version
254
97
  version: 0.2.0
255
98
  - !ruby/object:Gem::Dependency
256
- name: timecop
257
- requirement: !ruby/object:Gem::Requirement
258
- none: false
259
- requirements:
260
- - - ~>
261
- - !ruby/object:Gem::Version
262
- version: 0.7.1
263
- type: :development
264
- prerelease: false
265
- version_requirements: !ruby/object:Gem::Requirement
266
- none: false
267
- requirements:
268
- - - ~>
269
- - !ruby/object:Gem::Version
270
- version: 0.7.1
271
- - !ruby/object:Gem::Dependency
272
- name: thin
99
+ name: thor
273
100
  requirement: !ruby/object:Gem::Requirement
274
- none: false
275
101
  requirements:
276
- - - ~>
102
+ - - "~>"
277
103
  - !ruby/object:Gem::Version
278
- version: 1.6.4
279
- type: :development
104
+ version: 0.19.1
105
+ type: :runtime
280
106
  prerelease: false
281
107
  version_requirements: !ruby/object:Gem::Requirement
282
- none: false
283
108
  requirements:
284
- - - ~>
109
+ - - "~>"
285
110
  - !ruby/object:Gem::Version
286
- version: 1.6.4
287
- description: ! "\n`qless` is meant to be a performant alternative to other queueing\nsystems,
111
+ version: 0.19.1
112
+ description: "\n`qless` is meant to be a performant alternative to other queueing\nsystems,
288
113
  with statistics collection, a browser interface, and\nstrong guarantees about job
289
114
  losses.\n\nIt's written as a collection of Lua scipts that are loaded into the\nRedis
290
115
  instance to be used, and then executed by the client library.\nAs such, it's intended
@@ -296,19 +121,26 @@ email:
296
121
  - myron@moz.com
297
122
  executables:
298
123
  - qless-web
124
+ - qless-config
299
125
  extensions: []
300
126
  extra_rdoc_files: []
301
127
  files:
302
- - README.md
303
128
  - Gemfile
304
- - Rakefile
305
129
  - HISTORY.md
130
+ - README.md
131
+ - Rakefile
132
+ - exe/install_phantomjs
133
+ - exe/qless-config
134
+ - exe/qless-web
135
+ - lib/qless.rb
306
136
  - lib/qless/config.rb
307
137
  - lib/qless/failure_formatter.rb
308
138
  - lib/qless/job.rb
309
139
  - lib/qless/job_reservers/ordered.rb
310
140
  - lib/qless/job_reservers/round_robin.rb
311
141
  - lib/qless/job_reservers/shuffled_round_robin.rb
142
+ - lib/qless/lua/qless-lib.lua
143
+ - lib/qless/lua/qless.lua
312
144
  - lib/qless/lua_script.rb
313
145
  - lib/qless/middleware/memory_usage_monitor.rb
314
146
  - lib/qless/middleware/metriks.rb
@@ -319,19 +151,6 @@ files:
319
151
  - lib/qless/middleware/timeout.rb
320
152
  - lib/qless/queue.rb
321
153
  - lib/qless/server.rb
322
- - lib/qless/subscriber.rb
323
- - lib/qless/tasks.rb
324
- - lib/qless/test_helpers/worker_helpers.rb
325
- - lib/qless/version.rb
326
- - lib/qless/worker/base.rb
327
- - lib/qless/worker/forking.rb
328
- - lib/qless/worker/serial.rb
329
- - lib/qless/worker.rb
330
- - lib/qless.rb
331
- - lib/qless/lua/qless-lib.lua
332
- - lib/qless/lua/qless.lua
333
- - exe/install_phantomjs
334
- - exe/qless-web
335
154
  - lib/qless/server/static/css/bootstrap-responsive.css
336
155
  - lib/qless/server/static/css/bootstrap-responsive.min.css
337
156
  - lib/qless/server/static/css/bootstrap.css
@@ -380,28 +199,35 @@ files:
380
199
  - lib/qless/server/views/track.erb
381
200
  - lib/qless/server/views/worker.erb
382
201
  - lib/qless/server/views/workers.erb
202
+ - lib/qless/subscriber.rb
203
+ - lib/qless/tasks.rb
204
+ - lib/qless/test_helpers/worker_helpers.rb
205
+ - lib/qless/version.rb
206
+ - lib/qless/worker.rb
207
+ - lib/qless/worker/base.rb
208
+ - lib/qless/worker/forking.rb
209
+ - lib/qless/worker/serial.rb
383
210
  homepage: http://github.com/seomoz/qless
384
211
  licenses: []
212
+ metadata: {}
385
213
  post_install_message:
386
214
  rdoc_options: []
387
215
  require_paths:
388
216
  - lib
389
217
  required_ruby_version: !ruby/object:Gem::Requirement
390
- none: false
391
218
  requirements:
392
- - - ! '>='
219
+ - - ">="
393
220
  - !ruby/object:Gem::Version
394
221
  version: '0'
395
222
  required_rubygems_version: !ruby/object:Gem::Requirement
396
- none: false
397
223
  requirements:
398
- - - ! '>='
224
+ - - ">="
399
225
  - !ruby/object:Gem::Version
400
226
  version: '0'
401
227
  requirements: []
402
228
  rubyforge_project: qless
403
- rubygems_version: 1.8.23
229
+ rubygems_version: 2.4.5
404
230
  signing_key:
405
- specification_version: 3
231
+ specification_version: 4
406
232
  summary: A Redis-Based Queueing System
407
233
  test_files: []