batchy 0.0.7 → 0.0.8
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.
- data/lib/batchy.rb +1 -1
- data/lib/batchy/batch.rb +8 -0
- data/lib/batchy/version.rb +1 -1
- metadata +4 -4
data/lib/batchy.rb
CHANGED
data/lib/batchy/batch.rb
CHANGED
@@ -13,6 +13,8 @@ module Batchy
|
|
13
13
|
belongs_to :parent, :class_name => 'Batchy::Batch', :primary_key => :id, :foreign_key => :batch_id
|
14
14
|
has_many :children, :primary_key => :id, :foreign_key => :batch_id, :class_name => 'Batchy::Batch'
|
15
15
|
|
16
|
+
serialize :error
|
17
|
+
|
16
18
|
state_machine :state, :initial => :new do
|
17
19
|
event :start do
|
18
20
|
transition :new => :ignored, :if => :invalid_duplication
|
@@ -21,6 +23,7 @@ module Batchy
|
|
21
23
|
after_transition :new => :running do | batch, transition |
|
22
24
|
batch.started_at = DateTime.now
|
23
25
|
batch.pid = Process.pid
|
26
|
+
batch.hostname = Socket.gethostname
|
24
27
|
batch.save!
|
25
28
|
end
|
26
29
|
|
@@ -28,6 +31,7 @@ module Batchy
|
|
28
31
|
after_transition :new => :ignored do | batch, transition |
|
29
32
|
batch.started_at = DateTime.now
|
30
33
|
batch.finished_at = DateTime.now
|
34
|
+
batch.hostname = Socket.gethostname
|
31
35
|
batch.pid = Process.pid
|
32
36
|
batch.save!
|
33
37
|
end
|
@@ -92,6 +96,8 @@ module Batchy
|
|
92
96
|
|
93
97
|
# Issues a SIGTERM to the process running this batch
|
94
98
|
def kill
|
99
|
+
return false unless hostname == ::Socket.gethostname
|
100
|
+
|
95
101
|
Process.kill('TERM', pid)
|
96
102
|
end
|
97
103
|
|
@@ -99,6 +105,8 @@ module Batchy
|
|
99
105
|
# BE CAREFUL! This will kill your application or
|
100
106
|
# server if this batch has the same PID.
|
101
107
|
def kill!
|
108
|
+
return false unless hostname == ::Socket.gethostname
|
109
|
+
|
102
110
|
Process.kill('KILL', pid)
|
103
111
|
end
|
104
112
|
|
data/lib/batchy/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: batchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.8
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bob Briski
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-03-
|
13
|
+
date: 2012-03-29 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -166,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
166
|
requirements:
|
167
167
|
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
hash:
|
169
|
+
hash: 2217282660079083071
|
170
170
|
segments:
|
171
171
|
- 0
|
172
172
|
version: "0"
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
requirements:
|
176
176
|
- - ">="
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
hash:
|
178
|
+
hash: 2217282660079083071
|
179
179
|
segments:
|
180
180
|
- 0
|
181
181
|
version: "0"
|