job_boss 0.7.12 → 0.7.13

Sign up to get free protection for your applications and to get access to all the features.
data/job_boss.gemspec CHANGED
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "job_boss"
7
- s.version = '0.7.12'
7
+ s.version = '0.7.13'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Brian Underwood"]
10
10
  s.email = ["ml+job_boss@semi-sentient.com"]
data/lib/job_boss/boss.rb CHANGED
@@ -75,6 +75,10 @@ module JobBoss
75
75
 
76
76
  require_job_classes
77
77
 
78
+ Signal.trap("HUP") do
79
+ stop
80
+ end
81
+
78
82
  at_exit do
79
83
  stop if Process.pid == BOSS_PID
80
84
  end
data/lib/job_boss/job.rb CHANGED
@@ -10,6 +10,7 @@ module JobBoss
10
10
  scope :pending, where('started_at IS NULL AND cancelled_at IS NULL')
11
11
  scope :running, where('started_at IS NOT NULL AND completed_at IS NULL')
12
12
  scope :completed, where('completed_at IS NOT NULL')
13
+ scope :not_completed, where('completed_at IS NOT NULL')
13
14
  scope :mia, where("completed_at IS NOT NULL AND status = 'mia'")
14
15
 
15
16
  def prototype
@@ -74,6 +75,7 @@ module JobBoss
74
75
  self.started_at = nil
75
76
  self.result = nil
76
77
  self.completed_at = nil
78
+ self.cancelled_at = nil
77
79
  self.status = nil
78
80
  self.error_class = nil
79
81
  self.error_message = nil
@@ -174,7 +176,7 @@ module JobBoss
174
176
  # sleep_interval specifies polling period
175
177
  def wait_for_jobs(jobs = nil, sleep_interval = 0.5)
176
178
  at_exit do
177
- jobs.each(&:cancel)
179
+ Job.not_completed.find(jobs).each(&:cancel)
178
180
  end
179
181
 
180
182
  jobs = get_jobs(jobs)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: job_boss
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 12
10
- version: 0.7.12
9
+ - 13
10
+ version: 0.7.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Underwood
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-29 00:00:00 -04:00
18
+ date: 2011-04-01 00:00:00 -04:00
19
19
  default_executable: job_boss
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency