rocketjob 3.4.0 → 3.4.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abb40a0f5b7abce954efc71891845f43088af58b
|
4
|
+
data.tar.gz: 554a9d1df074fff449db727ce2bba2dcae8867b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ef4cff6fac8bb64b10b8b4be0a2c4b2e009510f964619423c8604ed78710a0712fe2a2cdf3e5a88450d233eaba74d999d6094f344f6ae53841abd223f1c622b
|
7
|
+
data.tar.gz: 7fcb27f62e344fe38ca20fae4178e021baafa955644abf9420d8970a250d7c59a24c41e488201bc47b140d03aad03a8772618ae68df0cc22e8c8757be3ee4afb
|
data/lib/rocket_job/cli.rb
CHANGED
@@ -2,6 +2,7 @@ require 'optparse'
|
|
2
2
|
require 'semantic_logger'
|
3
3
|
require 'mongoid'
|
4
4
|
require 'rocketjob'
|
5
|
+
require 'rocket_job/extensions/mongoid/factory'
|
5
6
|
module RocketJob
|
6
7
|
# Command Line Interface parser for RocketJob
|
7
8
|
class CLI
|
@@ -35,7 +36,7 @@ module RocketJob
|
|
35
36
|
write_pidfile
|
36
37
|
|
37
38
|
# In case Rails did not load the Mongoid Config
|
38
|
-
RocketJob::Config.load!(environment, mongo_config, symmetric_encryption_config) if Mongoid::Config.clients.empty?
|
39
|
+
RocketJob::Config.load!(environment, mongo_config, symmetric_encryption_config) if ::Mongoid::Config.clients.empty?
|
39
40
|
|
40
41
|
opts = {}
|
41
42
|
opts[:name] = name if name
|
@@ -132,8 +133,8 @@ module RocketJob
|
|
132
133
|
# Enable SemanticLogger signal handling for this process
|
133
134
|
SemanticLogger.add_signal_handler
|
134
135
|
|
135
|
-
Mongoid.logger = SemanticLogger[Mongoid]
|
136
|
-
Mongo::Logger.logger = SemanticLogger[Mongo]
|
136
|
+
::Mongoid.logger = SemanticLogger[::Mongoid]
|
137
|
+
::Mongo::Logger.logger = SemanticLogger[::Mongo]
|
137
138
|
end
|
138
139
|
|
139
140
|
# Eager load files in jobs folder
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mongoid/factory'
|
2
|
+
|
3
|
+
module RocketJob
|
4
|
+
module MongoidFactory
|
5
|
+
def from_db(*args)
|
6
|
+
super(*args)
|
7
|
+
rescue NameError => exc
|
8
|
+
RocketJob::Job.instantiate(attributes, selected_fields)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
::Mongoid::Factory.include(RocketJob::MongoidFactory)
|
@@ -45,7 +45,7 @@ module RocketJob
|
|
45
45
|
field :collect_output, type: Boolean, default: false, class_attribute: true
|
46
46
|
|
47
47
|
# Run this job no earlier than this time
|
48
|
-
field :run_at, type: Time
|
48
|
+
field :run_at, type: Time, user_editable: true
|
49
49
|
|
50
50
|
# If a job has not started by this time, destroy it
|
51
51
|
field :expires_at, type: Time, copy_on_restart: true
|
@@ -245,6 +245,22 @@ module RocketJob
|
|
245
245
|
queued? && run_at.present? && (run_at > Time.now)
|
246
246
|
end
|
247
247
|
|
248
|
+
# Return [true|false] whether this job is sleeping.
|
249
|
+
# I.e. No workers currently working on this job even if it is running.
|
250
|
+
def sleeping?
|
251
|
+
running? && (worker_count == 0)
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns [Integer] the number of workers currently working on this job.
|
255
|
+
def worker_count
|
256
|
+
running? && worker_name.present? ? 1 : 0
|
257
|
+
end
|
258
|
+
|
259
|
+
# Returns [Array<String>] names of workers currently working this job.
|
260
|
+
def worker_names
|
261
|
+
running? && worker_name.present? ? [worker_name] : []
|
262
|
+
end
|
263
|
+
|
248
264
|
# Returns [Hash] status of this job
|
249
265
|
def as_json
|
250
266
|
attrs = serializable_hash(methods: [:seconds, :duration])
|
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: 3.4.
|
4
|
+
version: 3.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/rocket_job/config.rb
|
85
85
|
- lib/rocket_job/dirmon_entry.rb
|
86
86
|
- lib/rocket_job/extensions/mongo/logging.rb
|
87
|
+
- lib/rocket_job/extensions/mongoid/factory.rb
|
87
88
|
- lib/rocket_job/extensions/rocket_job_adapter.rb
|
88
89
|
- lib/rocket_job/heartbeat.rb
|
89
90
|
- lib/rocket_job/job.rb
|