rbbt-util 5.13.16 → 5.13.17
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: 9ddf635c66e349edec5db389d7ea12e100698632
|
4
|
+
data.tar.gz: f4c5a82a06ab483a523fdbff17febbf055fbfd19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3b949791ad76faa6d56a9c2a33aaa4e0bb0b89bc125f162cd608711ca0b99449deb6e1c57652ecb926c2075b63ba686f9b314f2f2b7a0fd5614dcfc9867d359
|
7
|
+
data.tar.gz: 11aa669bba9855942de35bf4695521627005a35d2eaa0f1fa833751dca409715d16a81dafec21a098e155d4ca8dd7ba4c889c64a40664a6913dfe0260aec1f1f
|
@@ -9,9 +9,10 @@ class RbbtProcessQueue
|
|
9
9
|
def initialize
|
10
10
|
@sread, @swrite = Misc.pipe
|
11
11
|
|
12
|
-
key = rand(100000000).to_s;
|
12
|
+
key = "/" << rand(100000000).to_s;
|
13
13
|
@write_sem = key + '.in'
|
14
14
|
@read_sem = key + '.out'
|
15
|
+
Log.warn "Creating socket semaphores: #{key}"
|
15
16
|
RbbtSemaphore.create_semaphore(@write_sem,1)
|
16
17
|
RbbtSemaphore.create_semaphore(@read_sem,1)
|
17
18
|
end
|
@@ -19,6 +20,7 @@ class RbbtProcessQueue
|
|
19
20
|
def clean
|
20
21
|
@sread.close unless @sread.closed?
|
21
22
|
@swrite.close unless @swrite.closed?
|
23
|
+
Log.warn "Destroying socket semaphores: #{key}"
|
22
24
|
RbbtSemaphore.delete_semaphore(@write_sem)
|
23
25
|
RbbtSemaphore.delete_semaphore(@read_sem)
|
24
26
|
end
|
@@ -7,7 +7,7 @@ module Misc
|
|
7
7
|
|
8
8
|
dup_array = options.delete :dup_array
|
9
9
|
|
10
|
-
if
|
10
|
+
if Entity === field or (Entity.respond_to?(:formats) and Entity.formats.include? field)
|
11
11
|
params = options.dup
|
12
12
|
|
13
13
|
params[:format] ||= params.delete "format"
|
data/lib/rbbt/util/semaphore.rb
CHANGED
@@ -52,15 +52,11 @@ void post_semaphore(char* name){
|
|
52
52
|
|
53
53
|
SEM_MUTEX = Mutex.new
|
54
54
|
def self.synchronize(sem)
|
55
|
-
|
56
|
-
RbbtSemaphore.wait_semaphore(sem)
|
57
|
-
end
|
55
|
+
RbbtSemaphore.wait_semaphore(sem)
|
58
56
|
begin
|
59
57
|
yield
|
60
58
|
ensure
|
61
|
-
|
62
|
-
RbbtSemaphore.post_semaphore(sem)
|
63
|
-
end
|
59
|
+
RbbtSemaphore.post_semaphore(sem)
|
64
60
|
end
|
65
61
|
end
|
66
62
|
|
@@ -68,6 +64,7 @@ void post_semaphore(char* name){
|
|
68
64
|
file = "/" << Misc.digest(rand(1000000000000).to_s) if file.nil?
|
69
65
|
file.gsub!('/', '_')
|
70
66
|
begin
|
67
|
+
Log.warn "Creating semaphore (#{ size }): #{file}"
|
71
68
|
RbbtSemaphore.create_semaphore(file, size)
|
72
69
|
yield file
|
73
70
|
ensure
|
@@ -44,7 +44,7 @@ class Step
|
|
44
44
|
begin
|
45
45
|
@info_mutex.synchronize do
|
46
46
|
begin
|
47
|
-
return @info_cache if @info_cache and File.mtime(info_file)
|
47
|
+
return @info_cache if @info_cache and File.mtime(info_file) > @info_cache_time
|
48
48
|
rescue Exception
|
49
49
|
raise $!
|
50
50
|
end
|
@@ -65,7 +65,6 @@ class Step
|
|
65
65
|
end
|
66
66
|
rescue Exception
|
67
67
|
Log.debug{"Error loading info file: " + info_file}
|
68
|
-
#self.abort_pid
|
69
68
|
Open.write(info_file, INFO_SERIALIAZER.dump({:status => :error, :messages => ["Info file lost"]}))
|
70
69
|
raise $!
|
71
70
|
end
|
@@ -100,7 +99,12 @@ class Step
|
|
100
99
|
end
|
101
100
|
|
102
101
|
def status
|
103
|
-
|
102
|
+
begin
|
103
|
+
info[:status]
|
104
|
+
rescue Exception
|
105
|
+
Log.error "Exception reading status: #{$!.message}"
|
106
|
+
:error
|
107
|
+
end
|
104
108
|
end
|
105
109
|
|
106
110
|
def status=(status)
|
@@ -239,11 +243,11 @@ class Step
|
|
239
243
|
end
|
240
244
|
|
241
245
|
def error?
|
242
|
-
|
246
|
+
status == :error
|
243
247
|
end
|
244
248
|
|
245
249
|
def aborted?
|
246
|
-
@aborted ||
|
250
|
+
@aborted || status == :aborted
|
247
251
|
end
|
248
252
|
|
249
253
|
# {{{ INFO
|