auser-poolparty 0.2.41 → 0.2.42
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/poolparty/base_packages/poolparty.rb +1 -1
- data/lib/poolparty/modules/thread_pool.rb +0 -1
- data/lib/poolparty/net/remote.rb +1 -1
- data/lib/poolparty/net/remote_bases/ec2.rb +6 -2
- data/lib/poolparty/net/remoter.rb +26 -14
- data/lib/poolparty/version.rb +1 -1
- data/poolparty.gemspec +1 -1
- data/spec/poolparty/net/remoter_spec.rb +1 -1
- data/website/index.html +1 -1
- metadata +1 -1
@@ -27,7 +27,7 @@ module PoolParty
|
|
27
27
|
|
28
28
|
has_gempackage(:name => "rake", :download_url => "http://rubyforge.org/frs/download.php/43954/rake-0.8.3.gem")
|
29
29
|
has_gempackage(:name => "xml-simple", :download_url => "http://rubyforge.org/frs/download.php/18366/xml-simple-1.0.11.gem")
|
30
|
-
has_gempackage(:name => "
|
30
|
+
has_gempackage(:name => "amazon-ec2", :download_url => "http://rubyforge.org/frs/download.php/43666/amazon-ec2-0.3.1.gem", :requires => get_gempackage("xml-simple"))
|
31
31
|
|
32
32
|
has_gempackage(:name => "sexp_processor", :download_url => "http://rubyforge.org/frs/download.php/45589/sexp_processor-3.0.0.gem")
|
33
33
|
has_gempackage(:name => "ParseTree", :download_url => "http://rubyforge.org/frs/download.php/45600/ParseTree-3.0.1.gem", :requires => [get_gempackage("sexp_processor"), get_gempackage("ZenTest")])
|
data/lib/poolparty/net/remote.rb
CHANGED
@@ -19,10 +19,10 @@ module PoolParty
|
|
19
19
|
:size => "#{size || Base.size}")
|
20
20
|
begin
|
21
21
|
item = instance#.instancesSet.item
|
22
|
-
EC2ResponseObject.get_hash_from_response(item)
|
22
|
+
inst = EC2ResponseObject.get_hash_from_response(item)
|
23
23
|
rescue Exception => e
|
24
24
|
end
|
25
|
-
|
25
|
+
inst
|
26
26
|
end
|
27
27
|
# Terminate an instance by id
|
28
28
|
def terminate_instance!(instance_id=nil)
|
@@ -52,6 +52,10 @@ module PoolParty
|
|
52
52
|
def get_instances_description
|
53
53
|
EC2ResponseObject.get_descriptions(ec2.describe_instances).sort_by {|a| a[:launching_time]}
|
54
54
|
end
|
55
|
+
|
56
|
+
def after_launch_master(instance=nil)
|
57
|
+
ec2.associate_address(:instance_id => instance.instance_id, :public_ip => set_master_ip_to) if set_master_ip_to && instance
|
58
|
+
end
|
55
59
|
|
56
60
|
# Help create a keypair for the cloud
|
57
61
|
# This is a helper to create the keypair and add them to the cloud for you
|
@@ -104,6 +104,11 @@ module PoolParty
|
|
104
104
|
num.times {out << launch_new_instance!}
|
105
105
|
out
|
106
106
|
end
|
107
|
+
def request_launch_master_instance
|
108
|
+
after_launch_master(launch_new_instance!)
|
109
|
+
end
|
110
|
+
def after_launch_master(h={})
|
111
|
+
end
|
107
112
|
# Let's terminate an instance that is not the master instance
|
108
113
|
def request_termination_of_non_master_instance
|
109
114
|
inst = nonmaster_nonterminated_instances.last
|
@@ -142,7 +147,24 @@ module PoolParty
|
|
142
147
|
if can_start_a_new_instance? && !minimum_number_of_instances_are_running?
|
143
148
|
list_of_pending_instances.size == 0 ? request_launch_one_instance_at_a_time : wait("5.seconds")
|
144
149
|
reset!
|
145
|
-
launch_minimum_number_of_instances
|
150
|
+
launch_minimum_number_of_instances
|
151
|
+
provision_slaves_from_n(minimum_instances.to_i)
|
152
|
+
after_launched
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def provision_slaves_from_n(num=1)
|
157
|
+
reset!
|
158
|
+
when_no_pending_instances do
|
159
|
+
wait "10.seconds" # Give some time for ssh to startup
|
160
|
+
@num_instances = list_of_running_instances.size
|
161
|
+
last_instances = nonmaster_nonterminated_instances[(@num_instances - (num))..(@num_instances)]
|
162
|
+
last_instances.each do |inst|
|
163
|
+
PoolParty::Provisioner.provision_slave(inst, self, false) unless inst.master?
|
164
|
+
cmd = ". /etc/profile && cloud-provision -i #{inst.name.gsub(/node/, '')} #{unix_hide_string} &"
|
165
|
+
Kernel.system cmd
|
166
|
+
end
|
167
|
+
PoolParty::Provisioner.reconfigure_master(self, force)
|
146
168
|
end
|
147
169
|
end
|
148
170
|
# Launch the master and let the master handle the starting of the cloud
|
@@ -153,7 +175,7 @@ module PoolParty
|
|
153
175
|
def launch_and_configure_master!(testing=false)
|
154
176
|
vputs "Requesting to launch new instance"
|
155
177
|
logger.debug "Launching master"
|
156
|
-
|
178
|
+
request_launch_master_instance if list_of_pending_instances.size.zero? && can_start_a_new_instance? && !is_master_running?
|
157
179
|
|
158
180
|
vputs "Waiting for there to be no pending instances..."
|
159
181
|
when_no_pending_instances do
|
@@ -189,18 +211,8 @@ module PoolParty
|
|
189
211
|
@num = 1
|
190
212
|
request_launch_new_instances(@num)
|
191
213
|
|
192
|
-
|
193
|
-
|
194
|
-
reset!
|
195
|
-
wait "20.seconds" # Give some time for ssh to startup
|
196
|
-
@num_instances = nonmaster_nonterminated_instances.size
|
197
|
-
last_instances = nonmaster_nonterminated_instances[(@num_instances - (@num + 1))..(@num_instances)]
|
198
|
-
last_instances.each do |inst|
|
199
|
-
PoolParty::Provisioner.provision_slave(inst, self, false)
|
200
|
-
end
|
201
|
-
PoolParty::Provisioner.reconfigure_master(self, force)
|
202
|
-
after_launched
|
203
|
-
end
|
214
|
+
vputs "request_launch_new_instances: #{@num}"
|
215
|
+
provision_slaves_from_n(@num)
|
204
216
|
end
|
205
217
|
end
|
206
218
|
# Contract the cloud
|
data/lib/poolparty/version.rb
CHANGED
data/poolparty.gemspec
CHANGED
@@ -80,7 +80,7 @@ describe "Remoter" do
|
|
80
80
|
@tc.should_receive(:is_master_running?).and_return false
|
81
81
|
end
|
82
82
|
it "should ask to request_launch_new_instances when the master is not running and we can start a new instance" do
|
83
|
-
@tc.should_receive(:
|
83
|
+
@tc.should_receive(:request_launch_master_instance)
|
84
84
|
@tc.stub!(:can_start_a_new_instance?).and_return true
|
85
85
|
@tc.stub!(:is_master_running?).and_return false
|
86
86
|
end
|
data/website/index.html
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
<h1>PoolParty</h1>
|
35
35
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/poolparty"; return false'>
|
36
36
|
<p>Get Version</p>
|
37
|
-
<a href="http://rubyforge.org/projects/poolparty" class="numbers">0.2.
|
37
|
+
<a href="http://rubyforge.org/projects/poolparty" class="numbers">0.2.42</a>
|
38
38
|
</div>
|
39
39
|
<h1>‘Easy cloud computing’</h1>
|
40
40
|
<h2>What</h2>
|