rjob 0.5.4 → 0.5.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
  SHA256:
3
- metadata.gz: a449a71e4bc05ab0aa01d605cfd96ef3e1133377829750749c2c8cf0759a11d2
4
- data.tar.gz: 0fbe17674cc2dbb924c85b431a0160afc85eee4cc9598923c2bf6c61a5af9530
3
+ metadata.gz: 9bebd5026b07c43eca2bc4aacb4d11ea44fc4f5534df2dc4504617bb879f8767
4
+ data.tar.gz: 40bc336b11fd755eead4b65f08a9e747da34d424e6c7af13ad1d90cfd8d3f355
5
5
  SHA512:
6
- metadata.gz: b3079717e2b8cf013a383b4026794af68c2b52aece9633be7bc1aa3880161091b78dd4a9d717754a0e61de1cfe6492969ab2bd92781c948beb03cda7258c3a7e
7
- data.tar.gz: 3a7578b5135a1b7932e6c88b40111bf529068b950f71497ea423a1ae85d3ee502cca5e505bd1a2bafadaa34378e71a7fb970e0c54d963c53566f0a9625cd21f9
6
+ metadata.gz: ba483620e0863dae21b9b648e17b8e820d4672a79670290d9f32b661793dbf3148cb47c7e54efe4a563c929c908443acdfef46c699f97b889049c6cd74e150c8
7
+ data.tar.gz: 10cd5379b8e0aea0d2b7e6e0eec1ca66f5bb9e33f477e6ed07994bf7a7f1888fd9d765f99fa7291f107773534760ebf4415b3158aefde9db86b7d1a40891ec05
data/lib/rjob/cli.rb CHANGED
@@ -26,6 +26,8 @@ class Rjob::CLI
26
26
  require r
27
27
  end
28
28
 
29
+ Rjob::Context.instance.logger.info("Booting up rjob") if Rjob::Context.instance.logger
30
+
29
31
  run_workers if @run_workers
30
32
  end
31
33
 
data/lib/rjob/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Rjob
3
- VERSION = "0.5.4".freeze
3
+ VERSION = "0.5.6".freeze
4
4
  end
@@ -37,6 +37,14 @@ class Rjob::WorkerProcess
37
37
  @failed_count = Concurrent::AtomicFixnum.new
38
38
  @returned_count = Concurrent::AtomicFixnum.new
39
39
 
40
+ if @context.logger
41
+ if @context.logger.debug?
42
+ @context.logger.debug("rjob worker process start with prefix=#{@prefix}, max_threads=#{max_threads}")
43
+ else
44
+ @context.logger.info("rjob worker process start")
45
+ end
46
+ end
47
+
40
48
  @leader = nil
41
49
  @state = :new
42
50
  end
@@ -46,11 +54,11 @@ class Rjob::WorkerProcess
46
54
 
47
55
  Signal.trap("INT") do
48
56
  if @state == :exiting
49
- puts "Force exit requested. Exiting immediately"
50
- exit 1
57
+ puts("Force exit requested. Exiting immediately")
58
+ exit(1)
51
59
  else
52
60
  @state = :exiting
53
- puts "Exiting..."
61
+ puts("Exiting...")
54
62
  end
55
63
  end
56
64
 
@@ -114,11 +122,13 @@ class Rjob::WorkerProcess
114
122
 
115
123
  if @state == :exiting
116
124
  if @thread_pool.shutdown?
125
+ @context.logger.info("rjob successfully exiting now") if @context.logger
117
126
  @state = :exited
118
127
  elsif !@thread_pool.shuttingdown?
119
128
  @thread_pool.shutdown
120
129
  else
121
130
  puts "Waiting shutdown..."
131
+ @context.logger.info("rjob waiting for shutdown...") if @context.logger
122
132
  end
123
133
  end
124
134
 
@@ -242,7 +252,7 @@ class Rjob::WorkerProcess
242
252
  error = { message: "Unknown error" }
243
253
  end
244
254
 
245
- if @context.logger.respond_to?(:info)
255
+ if @context.logger&.info?
246
256
  @context.logger.info("Job '#{job.worker_class_name}' with args '#{job.worker_args}' failed: #{error}")
247
257
  end
248
258
 
@@ -255,6 +265,10 @@ class Rjob::WorkerProcess
255
265
  retry_options = job.worker_class.retry_options
256
266
 
257
267
  if retry_options[:retry]
268
+ if retry_options[:retry].is_a?(Hash)
269
+ retry_options = retry_options.merge(retry: true).merge(retry_options[:retry])
270
+ end
271
+
258
272
  exceptions = retry_options.fetch(:exceptions, [StandardError])
259
273
  should_handle = exceptions.any? { |e| e >= error[:error_class] }
260
274
 
@@ -287,7 +301,9 @@ class Rjob::WorkerProcess
287
301
  rescue StandardError => e
288
302
  if @context.logger.respond_to?(:error)
289
303
  s = job_processor.respond_to?(:job_str) ? job_processor.job_str : '<unknown>'
290
- @context.logger.error("UGHH! Error while notifying dead job error: #{s}")
304
+ msg = "UGHH! Error while notifying dead job error: #{s}"
305
+ puts(msg)
306
+ @context.logger.error(msg) if @context.logger
291
307
  end
292
308
  end
293
309
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - André D. Piske
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-12 00:00:00.000000000 Z
11
+ date: 2024-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -45,6 +45,9 @@ dependencies:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 3.0.5
48
+ - - "<="
49
+ - !ruby/object:Gem::Version
50
+ version: '6.0'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +55,9 @@ dependencies:
52
55
  - - ">="
53
56
  - !ruby/object:Gem::Version
54
57
  version: 3.0.5
58
+ - - "<="
59
+ - !ruby/object:Gem::Version
60
+ version: '6.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: msgpack
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
152
  - !ruby/object:Gem::Version
147
153
  version: '0'
148
154
  requirements: []
149
- rubygems_version: 3.4.20
155
+ rubygems_version: 3.5.6
150
156
  signing_key:
151
157
  specification_version: 4
152
158
  summary: Asynchronous job processing