lev 12.0.0 → 12.1.0
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/lib/lev/active_job/base.rb +4 -4
- data/lib/lev/active_job/configured_job.rb +2 -2
- data/lib/lev/null_status.rb +1 -1
- data/lib/lev/routine.rb +20 -12
- data/lib/lev/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36f2d078f5b053db33b4943cc4ea446fcb55144c75138f0b6218a86bb91a0173
|
4
|
+
data.tar.gz: 7cd0f512ca30c4d729ab21b4fb3a026acb4f7862c0ab1c91b0af6c9c47473ea0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bb1482577a5d79fdd4d6158dbd806be1d39a6e959d4f7fca8c99648ce7959348b21f229a42891dc7d1a9fabca7583a726fb7ab153387e8d2d30645163d271d3
|
7
|
+
data.tar.gz: 6bc07ed4006f3a315b72e37e3a9adf33918dbe98071222a5607f6bf4e0cfe09cb0499419bf4321e25c8f32a0001b729053a0b3bf83e206314703a4b656b43205
|
data/lib/lev/active_job/base.rb
CHANGED
@@ -3,7 +3,7 @@ module Lev
|
|
3
3
|
class Base < Lev.configuration.job_class
|
4
4
|
attr_accessor(:provider_job_id) unless respond_to?(:provider_job_id)
|
5
5
|
|
6
|
-
def perform_later(routine_class, options, *args, &block)
|
6
|
+
def perform_later(routine_class, options, *args, **kwargs, &block)
|
7
7
|
# Create a new status object
|
8
8
|
status = routine_class.create_status
|
9
9
|
|
@@ -25,7 +25,7 @@ module Lev
|
|
25
25
|
# Queue up the job and set the provider_job_id
|
26
26
|
# For delayed_job, requires either Rails 5 or
|
27
27
|
# http://stackoverflow.com/questions/29855768/rails-4-2-get-delayed-job-id-from-active-job
|
28
|
-
provider_job_id = self.class.send(:job_or_instantiate, *args, &block)
|
28
|
+
provider_job_id = self.class.send(:job_or_instantiate, *args, **kwargs, &block)
|
29
29
|
.enqueue(options)
|
30
30
|
.provider_job_id
|
31
31
|
status.set_provider_job_id(provider_job_id) \
|
@@ -35,14 +35,14 @@ module Lev
|
|
35
35
|
status.id
|
36
36
|
end
|
37
37
|
|
38
|
-
def perform(*args, &block)
|
38
|
+
def perform(*args, **kwargs, &block)
|
39
39
|
# Pop arguments added by perform_later
|
40
40
|
id = args.pop
|
41
41
|
routine_class = Kernel.const_get(args.pop)
|
42
42
|
|
43
43
|
routine_instance = routine_class.new(routine_class.find_status(id))
|
44
44
|
|
45
|
-
routine_instance.call(*args, &block)
|
45
|
+
routine_instance.call(*args, **kwargs, &block)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -12,8 +12,8 @@ module Lev
|
|
12
12
|
routine_class.active_job_enqueue_options.merge(@options)
|
13
13
|
end
|
14
14
|
|
15
|
-
def perform_later(*args, &block)
|
16
|
-
routine_class.job_class.new.perform_later(routine_class, options, *args, &block)
|
15
|
+
def perform_later(*args, **kwargs, &block)
|
16
|
+
routine_class.job_class.new.perform_later(routine_class, options, *args, **kwargs, &block)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/lev/null_status.rb
CHANGED
data/lib/lev/routine.rb
CHANGED
@@ -200,12 +200,12 @@ module Lev
|
|
200
200
|
end
|
201
201
|
|
202
202
|
module ClassMethods
|
203
|
-
def call(*args, &block)
|
204
|
-
new.call(*args, &block)
|
203
|
+
def call(*args, **kwargs, &block)
|
204
|
+
new.call(*args, **kwargs, &block)
|
205
205
|
end
|
206
206
|
|
207
|
-
def [](*args, &block)
|
208
|
-
result = call(*args, &block)
|
207
|
+
def [](*args, **kwargs, &block)
|
208
|
+
result = call(*args, **kwargs, &block)
|
209
209
|
result.errors.raise_exception_if_any!
|
210
210
|
result.outputs.send(@express_output)
|
211
211
|
end
|
@@ -222,9 +222,9 @@ module Lev
|
|
222
222
|
@active_job_enqueue_options || { queue: :default }
|
223
223
|
end
|
224
224
|
|
225
|
-
def perform_later(*args, &block)
|
225
|
+
def perform_later(*args, **kwargs, &block)
|
226
226
|
# Delegate to a subclass of Lev::Routine::ActiveJob::Base
|
227
|
-
job_class.new.perform_later(self, active_job_enqueue_options, *args, &block)
|
227
|
+
job_class.new.perform_later(self, active_job_enqueue_options, *args, **kwargs, &block)
|
228
228
|
end
|
229
229
|
|
230
230
|
# Called at a routine's class level to foretell which other routines will
|
@@ -279,7 +279,7 @@ module Lev
|
|
279
279
|
|
280
280
|
attr_reader :runner
|
281
281
|
|
282
|
-
def call(*args, &block)
|
282
|
+
def call(*args, **kwargs, &block)
|
283
283
|
@after_transaction_blocks = []
|
284
284
|
|
285
285
|
status.started!
|
@@ -290,9 +290,9 @@ module Lev
|
|
290
290
|
|
291
291
|
catch :fatal_errors_encountered do
|
292
292
|
if self.class.delegates_to
|
293
|
-
run(self.class.delegates_to, *args, &block)
|
293
|
+
run(self.class.delegates_to, *args, **kwargs, &block)
|
294
294
|
else
|
295
|
-
exec(*args, &block)
|
295
|
+
exec(*args, **kwargs, &block)
|
296
296
|
end
|
297
297
|
end
|
298
298
|
end
|
@@ -324,7 +324,7 @@ module Lev
|
|
324
324
|
who == topmost_runner && who.class.transaction_isolation != TransactionIsolation.no_transaction
|
325
325
|
end
|
326
326
|
|
327
|
-
def run(other_routine, *args, &block)
|
327
|
+
def run(other_routine, *args, **kwargs, &block)
|
328
328
|
options = {}
|
329
329
|
|
330
330
|
if other_routine.is_a? Array
|
@@ -395,7 +395,7 @@ module Lev
|
|
395
395
|
#
|
396
396
|
|
397
397
|
other_routine.runner = self
|
398
|
-
run_result = other_routine.call(*args, &block)
|
398
|
+
run_result = other_routine.call(*args, **kwargs, &block)
|
399
399
|
|
400
400
|
run_result.outputs.transfer_to(outputs) do |name|
|
401
401
|
output_mapper.map(name)
|
@@ -495,7 +495,15 @@ module Lev
|
|
495
495
|
def in_transaction(options={})
|
496
496
|
if transaction_run_by?(self)
|
497
497
|
isolation_symbol = self.class.transaction_isolation.symbol
|
498
|
-
if ActiveRecord::VERSION::MAJOR >=
|
498
|
+
if (ActiveRecord::VERSION::MAJOR >= 8 ||
|
499
|
+
(ActiveRecord::VERSION::MAJOR == 7 && ActiveRecord::VERSION::MINOR >= 1)) &&
|
500
|
+
ActiveRecord::Base.connection.transaction_open?
|
501
|
+
# Don't even try to set transaction isolation if the transaction is already open
|
502
|
+
ActiveRecord::Base.transaction do
|
503
|
+
yield
|
504
|
+
raise ActiveRecord::Rollback if errors?
|
505
|
+
end
|
506
|
+
elsif ActiveRecord::VERSION::MAJOR >= 4
|
499
507
|
begin
|
500
508
|
ActiveRecord::Base.transaction(isolation: isolation_symbol) do
|
501
509
|
yield
|
data/lib/lev/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.
|
4
|
+
version: 12.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Slavinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|