jason-o-matic-deep_test 1.2.2.10 → 1.2.2.11
Sign up to get free protection for your applications and to get access to all the features.
@@ -17,15 +17,38 @@ module DeepTest
|
|
17
17
|
|
18
18
|
def sync(options)
|
19
19
|
if options.sync_options[:push_code]
|
20
|
-
|
21
|
-
DeepTest.logger.debug "sync to: #{slave.inspect}"
|
22
|
-
RSync.sync(Struct.new(:address).new(URI::parse(slave.__drburi).host), options, options.mirror_path(slave.config[:work_dir]))
|
23
|
-
end
|
20
|
+
multi_push_sync(options)
|
24
21
|
else
|
25
22
|
DeepTest.logger.debug "dispatch sync for #{options.origin_hostname}"
|
26
23
|
@slave_controller.dispatch(:sync, options)
|
27
24
|
end
|
28
25
|
end
|
26
|
+
|
27
|
+
def multi_push_sync(options)
|
28
|
+
puts "Syncing..."
|
29
|
+
sync_start = Time.now
|
30
|
+
|
31
|
+
threads = @slaves.map do |slave|
|
32
|
+
Thread.new do
|
33
|
+
Thread.current[:receiver] = slave
|
34
|
+
Timeout.timeout(options.timeout_in_seconds) do
|
35
|
+
RSync.sync(Struct.new(:address).new(URI::parse(slave.__drburi).host), options, options.mirror_path(slave.config[:work_dir]))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
results = []
|
41
|
+
threads.each do |t|
|
42
|
+
begin
|
43
|
+
results << t.value
|
44
|
+
rescue Timeout::Error
|
45
|
+
DeepTest.logger.error "Timeout syncing to #{t[:receiver].__drburi}"
|
46
|
+
raise
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
puts "Sync took #{Time.now - sync_start} seconds"
|
51
|
+
end
|
29
52
|
|
30
53
|
class WorkerServerProxy
|
31
54
|
|
@@ -4,8 +4,9 @@ module DeepTest
|
|
4
4
|
def self.sync(connection_info, options, destination)
|
5
5
|
command = Args.new(connection_info, options).command(destination)
|
6
6
|
DeepTest.logger.debug("rsycing: #{command}")
|
7
|
-
|
8
|
-
raise "RSync Failed
|
7
|
+
output = `#{command}`
|
8
|
+
raise "RSync Failed!!\nCommand failed: #{command}\nWith output:\nBEGIN#{'=' * 80}\n#{output}\nEND#{'=' * 82}" unless $?.success?
|
9
|
+
output
|
9
10
|
end
|
10
11
|
|
11
12
|
class Args
|
@@ -20,7 +21,7 @@ module DeepTest
|
|
20
21
|
# The '/' after source tells rsync to copy the contents
|
21
22
|
# of source to destination, rather than the source directory
|
22
23
|
# itself
|
23
|
-
"rsync -az --delete #{@sync_options[:rsync_options]} #{source_location}/ #{destination_location(destination)}".strip.squeeze(" ")
|
24
|
+
"rsync -az --delete #{@sync_options[:rsync_options]} #{source_location}/ #{destination_location(destination)} 2>&1".strip.squeeze(" ")
|
24
25
|
end
|
25
26
|
|
26
27
|
def source_location
|