rocketjob 5.2.0.beta1 → 5.2.0.beta2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be987bf17c7505ce19a06f0f15bd612b0d9588a7aed842250b4f094b98b026ef
|
4
|
+
data.tar.gz: afb3b94b5f47c4fd462da9732f6b94d87b53f96e9afe22f66592c89eeed3c521
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f71a2a1aa604c1db1babf43ea5865724617515b7f0ea299e438d8fb4bb845d2a4ef21c4bbd5994034cb070c72c6b6f53dfbf45d2b52e576c8a2cb3202e1549a
|
7
|
+
data.tar.gz: 969bcffcb4aa38277b99f88188334e28393ed6fa92e5e470214879ec2d169e81a586947daaf3bcaea446ac8766e49e9c7dd328a4131bde0275808eff241a9437
|
@@ -53,6 +53,19 @@ module RocketJob
|
|
53
53
|
conn.where(:id.ne => slice.id).count >= throttle_running_workers
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
# Returns [Boolean] whether the throttle for this job has been exceeded
|
58
|
+
#
|
59
|
+
# With a Batch job, allow a higher priority queued job to replace a running one with
|
60
|
+
# a lower priority.
|
61
|
+
def throttle_running_jobs_exceeded?
|
62
|
+
return unless throttle_running_jobs&.positive?
|
63
|
+
|
64
|
+
# Cannot use this class since it will include instances of parent job classes.
|
65
|
+
RocketJob::Job.with(read: {mode: :primary}) do |conn|
|
66
|
+
conn.running.where("_type" => self.class.name, :id.ne => id, :priority.lt => priority).count >= throttle_running_jobs
|
67
|
+
end
|
68
|
+
end
|
56
69
|
end
|
57
70
|
end
|
58
71
|
end
|
@@ -129,7 +129,7 @@ module RocketJob
|
|
129
129
|
# Process a single slice from Mongo
|
130
130
|
# Once the slice has been successfully processed it will be removed from the input collection
|
131
131
|
# Returns [Integer] the number of records successfully processed
|
132
|
-
def rocket_job_process_slice(slice)
|
132
|
+
def rocket_job_process_slice(slice, &block)
|
133
133
|
# TODO: Skip records already processed
|
134
134
|
@rocket_job_record_number = slice.first_record_number || 0
|
135
135
|
@rocket_job_slice = slice
|
@@ -142,7 +142,7 @@ module RocketJob
|
|
142
142
|
RocketJob::Sliced::Writer::Output.collect(self, slice) do |writer|
|
143
143
|
slice.each do |record|
|
144
144
|
SemanticLogger.named_tagged(record: @rocket_job_record_number) do
|
145
|
-
writer << rocket_job_batch_perform(slice, record)
|
145
|
+
writer << rocket_job_batch_perform(slice, record, &block)
|
146
146
|
processed_records += 1
|
147
147
|
end
|
148
148
|
# JRuby thinks self.rocket_job_record_number= is private and cannot be accessed
|
@@ -202,7 +202,7 @@ module RocketJob
|
|
202
202
|
unless new_record?
|
203
203
|
# Fail job iff no other worker has already finished it
|
204
204
|
# Must set write concern to at least 1 since we need the nModified back
|
205
|
-
result
|
205
|
+
result = self.class.with(write: {w: 1}) do |query|
|
206
206
|
query.
|
207
207
|
where(id: id, state: :running, sub_state: :processing).
|
208
208
|
update({"$set" => {state: :failed, worker_name: worker_name}})
|
@@ -128,9 +128,7 @@ module RocketJob
|
|
128
128
|
# Returns the failed record.
|
129
129
|
# Returns [nil] if there is no failed record
|
130
130
|
def failed_record
|
131
|
-
if exception && processing_record_number
|
132
|
-
at(processing_record_number - 1)
|
133
|
-
end
|
131
|
+
at(processing_record_number - 1) if exception && processing_record_number
|
134
132
|
end
|
135
133
|
|
136
134
|
# Returns [Hash] the slice as a Hash for storage purposes
|
data/lib/rocket_job/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocketjob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.0.
|
4
|
+
version: 5.2.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aasm
|