drake 0.8.2.1.0.10 → 0.8.2.1.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,10 @@
1
1
 
2
2
  = Drake Changelog
3
3
 
4
+ == Version 0.8.2.1.0.11
5
+
6
+ * Remove drb code from this CompTree branch (reduce load time).
7
+
4
8
  == Version 0.8.2.1.0.10
5
9
 
6
10
  * Parents must be marked as needed during dry run for parallel tasks.
@@ -29,7 +29,7 @@
29
29
  # as a library via a require statement, but it can be distributed
30
30
  # independently as an application.
31
31
 
32
- RAKEVERSION = '0.8.2.1.0.10'
32
+ RAKEVERSION = '0.8.2.1.0.11'
33
33
 
34
34
  require 'rbconfig'
35
35
  require 'getoptlong'
@@ -1,6 +1,5 @@
1
1
 
2
2
  require 'rake/comp_tree/diagnostic'
3
- require 'rake/comp_tree/retriable_fork'
4
3
 
5
4
  module Rake::CompTree
6
5
  module Algorithm
@@ -1,6 +1,7 @@
1
1
 
2
2
  require 'rake/comp_tree/tap'
3
3
 
4
+ module Rake ; end
4
5
  module Rake::CompTree
5
6
  module Diagnostic
6
7
  def show(desc = nil, stream = STDOUT, &block)
@@ -1,5 +1,4 @@
1
1
 
2
- require 'rake/comp_tree/bucket_ipc'
3
2
  require 'rake/comp_tree/diagnostic'
4
3
  require 'rake/comp_tree/misc'
5
4
  require 'rake/comp_tree/algorithm'
@@ -1,6 +1,7 @@
1
1
 
2
2
  require 'thread'
3
3
 
4
+ module Rake ; end
4
5
  module Rake::CompTree
5
6
  module Misc
6
7
  def let
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2.1.0.10
4
+ version: 0.8.2.1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - James M. Lawrence
@@ -70,13 +70,11 @@ files:
70
70
  - lib/rake/testtask.rb
71
71
  - lib/rake.rb
72
72
  - lib/rake/comp_tree/algorithm.rb
73
- - lib/rake/comp_tree/bucket_ipc.rb
74
73
  - lib/rake/comp_tree/diagnostic.rb
75
74
  - lib/rake/comp_tree/driver.rb
76
75
  - lib/rake/comp_tree/error.rb
77
76
  - lib/rake/comp_tree/misc.rb
78
77
  - lib/rake/comp_tree/node.rb
79
- - lib/rake/comp_tree/retriable_fork.rb
80
78
  - lib/rake/comp_tree/tap.rb
81
79
  - lib/rake/comp_tree/task_node.rb
82
80
  - test/capture_stdout.rb
@@ -1,151 +0,0 @@
1
-
2
- require 'drb'
3
- require 'thread'
4
-
5
- require 'rake/comp_tree/retriable_fork'
6
- require 'rake/comp_tree/diagnostic'
7
- require 'rake/comp_tree/tap'
8
-
9
- module Rake::CompTree
10
- module BucketIPC
11
- class Bucket
12
- include Diagnostic
13
- include RetriableFork
14
-
15
- def initialize(address, timeout, wait_interval)
16
- trace "Making bucket with address #{address}"
17
-
18
- @remote_pid = fork {
19
- own_object = Class.new {
20
- attr_accessor(:contents)
21
- }.new
22
- server = DRb.start_service(address, own_object)
23
- debug {
24
- server.verbose = true
25
- }
26
- DRb.thread.join
27
- }
28
-
29
- @remote_object = DRbObject.new_with_uri(address)
30
- @address = address
31
- @timeout = timeout
32
- @wait_interval = wait_interval
33
- end
34
-
35
- attr_accessor(:timeout, :wait_interval)
36
- attr_reader(:address)
37
-
38
- def contents=(new_contents)
39
- connect {
40
- @remote_object.contents = new_contents
41
- }
42
- end
43
-
44
- def contents
45
- connect {
46
- @remote_object.contents
47
- }
48
- end
49
-
50
- def stop
51
- Process.kill("TERM", @remote_pid)
52
- end
53
-
54
- private
55
-
56
- def connect
57
- begin
58
- return yield
59
- rescue DRb::DRbConnError
60
- start = Time.now
61
- begin
62
- Kernel.sleep(@wait_interval)
63
- return yield
64
- rescue DRb::DRbConnError
65
- if Time.now - start > @timeout
66
- raise
67
- end
68
- retry
69
- end
70
- end
71
- end
72
- end
73
-
74
- class DriverBase
75
- def initialize(addresses, timeout, wait_interval)
76
- begin
77
- @buckets = addresses.map { |address|
78
- Bucket.new(address, timeout, wait_interval)
79
- }
80
- if block_given?
81
- yield @buckets
82
- end
83
- ensure
84
- if block_given?
85
- stop
86
- end
87
- end
88
- end
89
-
90
- def stop
91
- if defined?(@buckets)
92
- @buckets.each { |bucket|
93
- bucket.stop
94
- }
95
- end
96
- end
97
- end
98
-
99
- class Driver < DriverBase
100
- DEFAULTS = {
101
- :timeout => 0.5,
102
- :wait_interval => 0.05,
103
- :port_start => 18181,
104
- }
105
-
106
- module BucketCounter
107
- @mutex = Mutex.new
108
- @count = 0
109
- class << self
110
- def increment_count
111
- @mutex.synchronize {
112
- @count += 1
113
- }
114
- end
115
-
116
- def map_indexes(num_buckets)
117
- Array.new.tap { |result|
118
- num_buckets.times {
119
- result << yield(increment_count)
120
- }
121
- }
122
- end
123
- end
124
- end
125
-
126
- def initialize(num_buckets, opts_in = {})
127
- opts = DEFAULTS.merge(opts_in)
128
-
129
- addresses =
130
- if RetriableFork::HAVE_FORK
131
- #
132
- # Assume the existence of fork implies a unix machine.
133
- #
134
- require 'drb/unix'
135
- basename = "drbunix://#{Dir.tmpdir}/bucket.#{Process.pid}.#{rand}"
136
- BucketCounter.map_indexes(num_buckets) { |index|
137
- "#{basename}.#{index}"
138
- }
139
- else
140
- #
141
- # Fallback: use the default socket.
142
- #
143
- BucketCounter.map_indexes(num_buckets) { |index|
144
- "druby://localhost:#{opts[:port_start] + index}"
145
- }
146
- end
147
- super(addresses, opts[:timeout], opts[:wait_interval])
148
- end
149
- end
150
- end
151
- end
@@ -1,43 +0,0 @@
1
-
2
- module Rake ; end
3
- module Rake::CompTree
4
- module RetriableFork
5
- HAVE_FORK = lambda {
6
- begin
7
- process_id = fork { }
8
- Process.wait(process_id)
9
- rescue NotImplementedError
10
- return false
11
- end
12
- true
13
- }.call
14
-
15
- def fork(retry_wait = 10, retry_max = 10, &block)
16
- num_retries = 0
17
- begin
18
- Process.fork(&block)
19
- rescue Errno::EAGAIN
20
- num_retries += 1
21
- if num_retries == retry_max
22
- message = %Q{
23
- ****************************************************************
24
- Maximum number of EAGAIN signals reached (#{retry_max})
25
- ****************************************************************
26
-
27
- Either increase your process limit permission (consult your
28
- OS manual) or run this script as superuser.
29
-
30
- ****************************************************************
31
- }
32
- STDERR.puts(message.gsub(%r!^[ \t]+!, ""))
33
- raise
34
- end
35
- STDERR.puts "Caught EGAIN. Retrying in #{retry_wait} seconds."
36
- sleep(retry_wait)
37
- retry
38
- end
39
- end
40
- module_function :fork
41
- end
42
- end
43
-