auser-poolparty 0.2.48 → 0.2.49

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.
Files changed (36) hide show
  1. data/Manifest.txt +15 -1
  2. data/Rakefile +1 -1
  3. data/bin/cloud-stats +17 -0
  4. data/bin/server-get-load +1 -6
  5. data/bin/server-show-stats +1 -8
  6. data/bin/server-start-client +22 -0
  7. data/bin/server-start-master +2 -9
  8. data/lib/erlang/messenger/ebin/client.app +19 -0
  9. data/lib/erlang/messenger/ebin/pm_client_rel-0.1.rel +1 -0
  10. data/lib/erlang/messenger/pm_client_rel-0.1.boot +0 -0
  11. data/lib/erlang/messenger/pm_client_rel-0.1.script +246 -0
  12. data/lib/erlang/messenger/pm_master_rel-0.1.script +1 -1
  13. data/lib/erlang/messenger/pm_node_rel-0.1.script +1 -1
  14. data/lib/erlang/messenger/src/client_app.erl +39 -0
  15. data/lib/erlang/messenger/src/client_server.erl +43 -0
  16. data/lib/erlang/messenger/src/pm_client.erl +48 -51
  17. data/lib/erlang/messenger/src/pm_client_old.erl +52 -0
  18. data/lib/erlang/messenger/src/pm_client_supervisor.erl +38 -0
  19. data/lib/erlang/messenger/src/pm_master.erl +5 -3
  20. data/lib/erlang/messenger/src/pm_node.erl +1 -1
  21. data/lib/erlang/messenger/src/pm_packager.erl +4 -1
  22. data/lib/erlang/messenger/src/utils.erl +1 -1
  23. data/lib/poolparty/base_packages/poolparty.rb +3 -1
  24. data/lib/poolparty/helpers/binary.rb +2 -1
  25. data/lib/poolparty/helpers/console.rb +4 -4
  26. data/lib/poolparty/helpers/optioner.rb +1 -1
  27. data/lib/poolparty/monitors/base_monitor.rb +1 -1
  28. data/lib/poolparty/net/messenger.rb +21 -6
  29. data/lib/poolparty/pool/base.rb +1 -0
  30. data/lib/poolparty/pool/pool.rb +2 -1
  31. data/lib/poolparty/version.rb +1 -1
  32. data/poolparty.gemspec +18 -3
  33. data/spec/poolparty/bin/console_spec.rb +18 -0
  34. data/spec/poolparty/monitors/base_monitor_spec.rb +7 -4
  35. metadata +18 -3
  36. data/bin/messenger-get-load +0 -28
data/Manifest.txt CHANGED
@@ -19,8 +19,8 @@ bin/cloud-refresh
19
19
  bin/cloud-run
20
20
  bin/cloud-ssh
21
21
  bin/cloud-start
22
+ bin/cloud-stats
22
23
  bin/cloud-terminate
23
- bin/messenger-get-load
24
24
  bin/pool
25
25
  bin/pool-console
26
26
  bin/pool-describe
@@ -34,6 +34,7 @@ bin/server-list-active
34
34
  bin/server-list-responding
35
35
  bin/server-rerun
36
36
  bin/server-show-stats
37
+ bin/server-start-client
37
38
  bin/server-start-master
38
39
  bin/server-start-node
39
40
  config/hoe.rb
@@ -50,6 +51,9 @@ lib/erlang/messenger/Makefile
50
51
  lib/erlang/messenger/README
51
52
  lib/erlang/messenger/Rakefile
52
53
  lib/erlang/messenger/control
54
+ lib/erlang/messenger/ebin/client.app
55
+ lib/erlang/messenger/ebin/client_app.beam
56
+ lib/erlang/messenger/ebin/client_server.beam
53
57
  lib/erlang/messenger/ebin/erl_crash.dump
54
58
  lib/erlang/messenger/ebin/master.app
55
59
  lib/erlang/messenger/ebin/master_app.beam
@@ -57,6 +61,9 @@ lib/erlang/messenger/ebin/node.app
57
61
  lib/erlang/messenger/ebin/node_app.beam
58
62
  lib/erlang/messenger/ebin/packager.app
59
63
  lib/erlang/messenger/ebin/pm_client.beam
64
+ lib/erlang/messenger/ebin/pm_client_old.beam
65
+ lib/erlang/messenger/ebin/pm_client_rel-0.1.rel
66
+ lib/erlang/messenger/ebin/pm_client_supervisor.beam
60
67
  lib/erlang/messenger/ebin/pm_cluster.beam
61
68
  lib/erlang/messenger/ebin/pm_event_manager.beam
62
69
  lib/erlang/messenger/ebin/pm_master.beam
@@ -125,13 +132,20 @@ lib/erlang/messenger/lib/eunit/src/eunit_tty.erl
125
132
  lib/erlang/messenger/lib/eunit/src/file_monitor.erl
126
133
  lib/erlang/messenger/lib/eunit/sys.config
127
134
  lib/erlang/messenger/lib/eunit/vsn.mk
135
+ lib/erlang/messenger/log/pool.logs
136
+ lib/erlang/messenger/pm_client_rel-0.1.boot
137
+ lib/erlang/messenger/pm_client_rel-0.1.script
128
138
  lib/erlang/messenger/pm_master_rel-0.1.boot
129
139
  lib/erlang/messenger/pm_master_rel-0.1.script
130
140
  lib/erlang/messenger/pm_node_rel-0.1.boot
131
141
  lib/erlang/messenger/pm_node_rel-0.1.script
142
+ lib/erlang/messenger/src/client_app.erl
143
+ lib/erlang/messenger/src/client_server.erl
132
144
  lib/erlang/messenger/src/master_app.erl
133
145
  lib/erlang/messenger/src/node_app.erl
134
146
  lib/erlang/messenger/src/pm_client.erl
147
+ lib/erlang/messenger/src/pm_client_old.erl
148
+ lib/erlang/messenger/src/pm_client_supervisor.erl
135
149
  lib/erlang/messenger/src/pm_cluster.erl
136
150
  lib/erlang/messenger/src/pm_event_manager.erl
137
151
  lib/erlang/messenger/src/pm_master.erl
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ desc "Generate a new manifest and a new gem"
21
21
  task :build_local_gem => [:clean_tmp, :spec, :clean_pkg, :"manifest:refresh", :package]
22
22
 
23
23
  desc "Generate gemspec"
24
- task :gemspec => [:spec, :clean_tmp, :"manifest:refresh", :local_deploy] do |t|
24
+ task :gemspec => [:spec, :clean_tmp, :"manifest:refresh", :build_local_gem] do |t|
25
25
  res = %x[rake debug_gem]
26
26
  res = res.split("\n")[1..-1].join("\n")
27
27
  ::File.open("#{GEM_NAME.downcase}.gemspec", "w+") do |f|
data/bin/cloud-stats ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
+ require "poolparty"
4
+ require "poolpartycl"
5
+
6
+ o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
7
+ opts.on('-n name', '--name name', 'Stats for cloud name') { |c| optioner.cloudname c }
8
+ end
9
+
10
+ o.loaded_clouds.each do |cloud|
11
+
12
+ with_cloud(cloud) do
13
+ puts header("#{name.to_s.capitalize} cloud stats")
14
+ run_command_on(". /etc/profile && server-show-stats", master)
15
+ end
16
+
17
+ end
data/bin/server-get-load CHANGED
@@ -9,14 +9,9 @@ o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
9
9
  opts.on('-m name', '--monitor monitor_name', "Monitor name (default: cpu) (Available monitors: #{available_monitors.join(", ")})") {|c| optioner.monitorname c}
10
10
  end
11
11
 
12
- load_pool(o.spec || Binary.get_existing_spec_location)
13
-
14
- include Remote
15
-
16
- @clouds = extract_cloud_from_options o
17
12
  @monitor = o.monitorname ? o.monitorname : "cpu"
18
13
 
19
- @clouds.each do |cl|
14
+ o.loaded_clouds.each do |cl|
20
15
 
21
16
  with_cloud(cl, {:testing => o.testing, :monitorname => @monitor }) do
22
17
  if PoolParty::Monitors.available_monitors.include?(monitorname.downcase.to_sym)
@@ -3,17 +3,10 @@ $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
5
 
6
- available_monitors = PoolParty::Monitors.available_monitors
7
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
8
7
  end
9
8
 
10
- load_pool(o.spec || Binary.get_existing_spec_location)
11
-
12
- include Remote
13
-
14
- @clouds = extract_cloud_from_options o
15
-
16
- @clouds.each do |cloud|
9
+ o.loaded_clouds.each do |cloud|
17
10
 
18
11
  with_cloud(cloud, {:testing => o.testing }) do
19
12
  puts header("Stats")
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
+ require "poolparty"
4
+ require "poolpartycl"
5
+
6
+ o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
7
+ opts.on('-n name', '--name name', 'Host name') { |h| optioner.hostname h }
8
+ end
9
+
10
+ o.loaded_clouds.each do |cloud|
11
+
12
+ with_cloud(cloud) do
13
+
14
+ boot_file = "#{Messenger.append_dir}/pm_client_rel-0.1"
15
+ command = Messenger.erl_command("client", "-boot #{boot_file} #{noshell ? "" : "-detached -heart"}", 7050, 7050)
16
+
17
+ vputs "Running #{command}"
18
+
19
+ Kernel.system "exec #{command}" unless testing
20
+ end
21
+
22
+ end
@@ -3,20 +3,13 @@ $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
  require "poolparty"
4
4
  require "poolpartycl"
5
5
 
6
- available_monitors = PoolParty::Monitors.available_monitors
7
6
  o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
8
7
  opts.on('-n name', '--name name', 'Host name') { |h| optioner.hostname h }
9
8
  end
10
9
 
11
- load_pool(o.spec || Binary.get_existing_spec_location)
12
-
13
- include Remote
14
-
15
- @clouds = extract_cloud_from_options o
16
-
17
- @clouds.each do |cloud|
10
+ o.loaded_clouds.each do |cloud|
18
11
 
19
- with_cloud(cloud, {:testing => o.testing, :verbose => o.verbose }) do
12
+ with_cloud(cloud) do
20
13
 
21
14
  boot_file = "#{Messenger.append_dir}/pm_master_rel-0.1"
22
15
  command = Messenger.erl_command("master", "-boot #{boot_file} #{noshell ? "" : "-detached -heart"}")
@@ -0,0 +1,19 @@
1
+ {application, client,
2
+ [
3
+ % Quick description of the server
4
+ {description, "Client Server for PoolParty"},
5
+ % Version
6
+ {vsn, "0.1"},
7
+ % All modules used by the application.
8
+ {modules, [client_app, pm_client, client_server, pm_client_supervisor, utils]},
9
+ % All the registered names in the application
10
+ {registered, [client_server, pm_client_supervisor]},
11
+ % These must be started for application to run
12
+ {applications, [kernel, stdlib]},
13
+ % Environment vars
14
+ {env, []},
15
+ % Module and Args used to start
16
+ {mod, {client_app, []}},
17
+ {start_phases, []}
18
+ ]
19
+ }.
@@ -0,0 +1 @@
1
+ {release, {"client","0.1"}, {erts,"5.6.2"},[{kernel,"2.12.2"},{stdlib,"1.15.2"},{inets,"5.0.5"},{crypto,"1.5.1.1"},{sasl,"2.1.5.2"},{client,"0.1"}]}.
@@ -0,0 +1,246 @@
1
+ %% script generated at {2008,11,10} {16,32,20}
2
+ {script,
3
+ {"client","0.1"},
4
+ [{preLoaded,
5
+ [erlang,erl_prim_loader,prim_file,prim_inet,init,otp_ring0]},
6
+ {progress,preloaded},
7
+ {path,
8
+ ["/opt/local/lib/erlang/lib/kernel-2.12.2/ebin",
9
+ "/opt/local/lib/erlang/lib/stdlib-1.15.2/ebin"]},
10
+ {primLoad,[error_handler]},
11
+ {kernel_load_completed},
12
+ {progress,kernel_load_completed},
13
+ {path,["/opt/local/lib/erlang/lib/kernel-2.12.2/ebin"]},
14
+ {primLoad,
15
+ [zlib,wrap_log_reader,user_sup,user_drv,user,seq_trace,rpc,
16
+ ram_file,pg2,packages,os,net_kernel,net_adm,net,
17
+ kernel_config,kernel,inet_udp,inet_tcp_dist,inet_tcp,
18
+ inet_sctp,inet_res,inet_parse,inet_hosts,
19
+ inet_gethost_native,inet_dns,inet_db,inet_config,inet6_udp,
20
+ inet6_tcp_dist,inet6_tcp,inet,hipe_unified_loader,heart,
21
+ group,global_search,global_group,global,gen_udp,gen_tcp,
22
+ gen_sctp,file_server,file_io_server,file,erts_debug,
23
+ error_logger,erl_reply,erl_epmd,erl_distribution,erl_ddll,
24
+ erl_boot_server,dist_util,dist_ac,disk_log_sup,
25
+ disk_log_server,disk_log_1,disk_log,code_server,code_aux,
26
+ code,auth,application_starter,application_master,
27
+ application_controller,application]},
28
+ {path,["/opt/local/lib/erlang/lib/stdlib-1.15.2/ebin"]},
29
+ {primLoad,
30
+ [zip,win32reg,timer,sys,supervisor_bridge,supervisor,string,
31
+ sofs,slave,shell_default,shell,sets,regexp,random,queue,
32
+ qlc_pt,qlc,proplists,proc_lib,pool,pg,otp_internal,ordsets,
33
+ orddict,ms_transform,math,log_mf_h,lists,lib,io_lib_pretty,
34
+ io_lib_fread,io_lib_format,io_lib,io,gen_server,gen_fsm,
35
+ gen_event,gen,gb_trees,gb_sets,filename,filelib,file_sorter,
36
+ eval_bits,ets,escript,error_logger_tty_h,
37
+ error_logger_file_h,erl_tar,erl_scan,erl_pp,erl_posix_msg,
38
+ erl_parse,erl_lint,erl_internal,erl_expand_records,erl_eval,
39
+ erl_compile,erl_bits,epp,edlin_expand,edlin,digraph_utils,
40
+ digraph,dict,dets_v9,dets_v8,dets_utils,dets_sup,
41
+ dets_server,dets,calendar,c,beam_lib,base64,array]},
42
+ {path,["/opt/local/lib/erlang/lib/inets-5.0.5/ebin"]},
43
+ {primLoad,
44
+ [tftp_sup,tftp_lib,tftp_file,tftp_engine,tftp_binary,tftp,
45
+ mod_trace,mod_security_server,mod_security,
46
+ mod_responsecontrol,mod_range,mod_log,mod_include,
47
+ mod_htaccess,mod_head,mod_get,mod_esi,mod_disk_log,mod_dir,
48
+ mod_cgi,mod_browser,mod_auth_server,mod_auth_plain,
49
+ mod_auth_mnesia,mod_auth_dets,mod_auth,mod_alias,
50
+ mod_actions,inets_sup,inets_service,inets_app,inets,
51
+ httpd_util,httpd_sup,httpd_socket,httpd_script_env,
52
+ httpd_response,httpd_request_handler,httpd_request,
53
+ httpd_misc_sup,httpd_manager,httpd_log,httpd_instance_sup,
54
+ httpd_file,httpd_example,httpd_esi,httpd_conf,httpd_cgi,
55
+ httpd_acceptor_sup,httpd_acceptor,httpd,httpc_sup,
56
+ httpc_response,httpc_request,httpc_profile_sup,
57
+ httpc_manager,httpc_handler_sup,httpc_handler,http_util,
58
+ http_uri,http_transport,http_response,http_request,
59
+ http_cookie,http_chunk,http,ftp_sup,ftp_response,
60
+ ftp_progress,ftp]},
61
+ {path,["/opt/local/lib/erlang/lib/crypto-1.5.1.1/ebin"]},
62
+ {primLoad,[crypto_sup,crypto_server,crypto_app,crypto]},
63
+ {path,["/opt/local/lib/erlang/lib/sasl-2.1.5.2/ebin"]},
64
+ {primLoad,
65
+ [systools_relup,systools_rc,systools_make,systools_lib,
66
+ systools,sasl_report_tty_h,sasl_report_file_h,sasl_report,
67
+ sasl,release_handler_1,release_handler,rb_format_supp,rb,
68
+ overload,misc_supp,format_lib_supp,erlsrv,alarm_handler]},
69
+ {path,
70
+ ["/Users/auser/Sites/work/citrusbyte/internal/gems/pool-party/poolparty/lib/erlang/messenger/ebin"]},
71
+ {primLoad,
72
+ [utils,pm_client_supervisor,pm_client,client_server,
73
+ client_app]},
74
+ {progress,modules_loaded},
75
+ {path,
76
+ ["/opt/local/lib/erlang/lib/kernel-2.12.2/ebin",
77
+ "/opt/local/lib/erlang/lib/stdlib-1.15.2/ebin",
78
+ "/opt/local/lib/erlang/lib/inets-5.0.5/ebin",
79
+ "/opt/local/lib/erlang/lib/crypto-1.5.1.1/ebin",
80
+ "/opt/local/lib/erlang/lib/sasl-2.1.5.2/ebin",
81
+ "/Users/auser/Sites/work/citrusbyte/internal/gems/pool-party/poolparty/lib/erlang/messenger/ebin"]},
82
+ {kernelProcess,heart,{heart,start,[]}},
83
+ {kernelProcess,error_logger,{error_logger,start_link,[]}},
84
+ {kernelProcess,application_controller,
85
+ {application_controller,start,
86
+ [{application,kernel,
87
+ [{description,"ERTS CXC 138 10"},
88
+ {vsn,"2.12.2"},
89
+ {id,[]},
90
+ {modules,
91
+ [application,application_controller,application_master,
92
+ application_starter,auth,code,code_aux,packages,
93
+ code_server,dist_util,erl_boot_server,
94
+ erl_distribution,erl_prim_loader,erl_reply,erlang,
95
+ error_handler,error_logger,file,file_server,
96
+ file_io_server,prim_file,global,global_group,
97
+ global_search,group,heart,hipe_unified_loader,
98
+ inet6_tcp,inet6_tcp_dist,inet6_udp,inet_config,
99
+ inet_hosts,inet_gethost_native,inet_tcp_dist,init,
100
+ kernel,kernel_config,net,net_adm,net_kernel,os,
101
+ ram_file,rpc,user,user_drv,user_sup,disk_log,
102
+ disk_log_1,disk_log_server,disk_log_sup,dist_ac,
103
+ erl_ddll,erl_epmd,erts_debug,gen_tcp,gen_udp,gen_sctp,
104
+ prim_inet,inet,inet_db,inet_dns,inet_parse,inet_res,
105
+ inet_tcp,inet_udp,inet_sctp,pg2,seq_trace,
106
+ wrap_log_reader,zlib,otp_ring0]},
107
+ {registered,
108
+ [application_controller,erl_reply,auth,boot_server,
109
+ code_server,disk_log_server,disk_log_sup,
110
+ erl_prim_loader,error_logger,file_server_2,
111
+ fixtable_server,global_group,global_name_server,heart,
112
+ init,kernel_config,kernel_sup,net_kernel,net_sup,rex,
113
+ user,os_server,ddll_server,erl_epmd,inet_db,pg2]},
114
+ {applications,[]},
115
+ {included_applications,[]},
116
+ {env,[{error_logger,tty}]},
117
+ {start_phases,undefined},
118
+ {maxT,infinity},
119
+ {maxP,infinity},
120
+ {mod,{kernel,[]}}]}]}},
121
+ {progress,init_kernel_started},
122
+ {apply,
123
+ {application,load,
124
+ [{application,stdlib,
125
+ [{description,"ERTS CXC 138 10"},
126
+ {vsn,"1.15.2"},
127
+ {id,[]},
128
+ {modules,
129
+ [array,base64,beam_lib,c,calendar,dets,dets_server,
130
+ dets_sup,dets_utils,dets_v8,dets_v9,dict,digraph,
131
+ digraph_utils,edlin,edlin_expand,epp,eval_bits,
132
+ erl_bits,erl_compile,erl_eval,erl_expand_records,
133
+ erl_internal,erl_lint,erl_parse,erl_posix_msg,erl_pp,
134
+ erl_scan,erl_tar,error_logger_file_h,
135
+ error_logger_tty_h,escript,ets,file_sorter,filelib,
136
+ filename,gb_trees,gb_sets,gen,gen_event,gen_fsm,
137
+ gen_server,io,io_lib,io_lib_format,io_lib_fread,
138
+ io_lib_pretty,lib,lists,log_mf_h,math,ms_transform,
139
+ orddict,ordsets,otp_internal,pg,pool,proc_lib,
140
+ proplists,qlc,qlc_pt,queue,random,regexp,sets,shell,
141
+ shell_default,slave,sofs,string,supervisor,
142
+ supervisor_bridge,sys,timer,win32reg,zip]},
143
+ {registered,
144
+ [timer_server,rsh_starter,take_over_monitor,
145
+ pool_master,dets]},
146
+ {applications,[kernel]},
147
+ {included_applications,[]},
148
+ {env,[]},
149
+ {start_phases,undefined},
150
+ {maxT,infinity},
151
+ {maxP,infinity}]}]}},
152
+ {apply,
153
+ {application,load,
154
+ [{application,inets,
155
+ [{description,"INETS CXC 138 49"},
156
+ {vsn,"5.0.5"},
157
+ {id,[]},
158
+ {modules,
159
+ [inets,inets_sup,inets_app,inets_service,ftp,
160
+ ftp_progress,ftp_response,ftp_sup,http,httpc_handler,
161
+ httpc_handler_sup,httpc_manager,httpc_profile_sup,
162
+ httpc_request,httpc_response,httpc_sup,http_cookie,
163
+ http_uri,http_chunk,http_request,http_response,
164
+ http_transport,http_util,httpd,httpd_acceptor,
165
+ httpd_acceptor_sup,httpd_cgi,httpd_conf,httpd_esi,
166
+ httpd_example,httpd_file,httpd_instance_sup,httpd_log,
167
+ httpd_manager,httpd_misc_sup,httpd_request,
168
+ httpd_request_handler,httpd_response,httpd_script_env,
169
+ httpd_socket,httpd_sup,httpd_util,mod_actions,
170
+ mod_alias,mod_auth,mod_auth_dets,mod_auth_mnesia,
171
+ mod_auth_plain,mod_auth_server,mod_browser,mod_cgi,
172
+ mod_dir,mod_disk_log,mod_esi,mod_get,mod_head,
173
+ mod_htaccess,mod_include,mod_log,mod_range,
174
+ mod_responsecontrol,mod_security,mod_security_server,
175
+ mod_trace,tftp,tftp_binary,tftp_engine,tftp_file,
176
+ tftp_lib,tftp_sup]},
177
+ {registered,[inets_sup,httpc_manager]},
178
+ {applications,[kernel,stdlib]},
179
+ {included_applications,[]},
180
+ {env,[]},
181
+ {start_phases,undefined},
182
+ {maxT,infinity},
183
+ {maxP,infinity},
184
+ {mod,{inets_app,[]}}]}]}},
185
+ {apply,
186
+ {application,load,
187
+ [{application,crypto,
188
+ [{description,"CRYPTO version 1"},
189
+ {vsn,"1.5.1.1"},
190
+ {id,[]},
191
+ {modules,[crypto,crypto_app,crypto_sup,crypto_server]},
192
+ {registered,[crypto_sup,crypto_server]},
193
+ {applications,[kernel,stdlib]},
194
+ {included_applications,[]},
195
+ {env,[]},
196
+ {start_phases,undefined},
197
+ {maxT,infinity},
198
+ {maxP,infinity},
199
+ {mod,{crypto_app,[]}}]}]}},
200
+ {apply,
201
+ {application,load,
202
+ [{application,sasl,
203
+ [{description,"SASL CXC 138 11"},
204
+ {vsn,"2.1.5.2"},
205
+ {id,[]},
206
+ {modules,
207
+ [sasl,alarm_handler,format_lib_supp,misc_supp,overload,
208
+ rb,rb_format_supp,release_handler,release_handler_1,
209
+ erlsrv,sasl_report,sasl_report_tty_h,
210
+ sasl_report_file_h,systools,systools_make,systools_rc,
211
+ systools_relup,systools_lib]},
212
+ {registered,
213
+ [sasl_sup,alarm_handler,overload,release_handler]},
214
+ {applications,[kernel,stdlib]},
215
+ {included_applications,[]},
216
+ {env,[{sasl_error_logger,tty},{errlog_type,all}]},
217
+ {start_phases,undefined},
218
+ {maxT,infinity},
219
+ {maxP,infinity},
220
+ {mod,{sasl,[]}}]}]}},
221
+ {apply,
222
+ {application,load,
223
+ [{application,client,
224
+ [{description,"Client Server for PoolParty"},
225
+ {vsn,"0.1"},
226
+ {id,[]},
227
+ {modules,
228
+ [client_app,pm_client,client_server,
229
+ pm_client_supervisor,utils]},
230
+ {registered,[client_server,pm_client_supervisor]},
231
+ {applications,[kernel,stdlib]},
232
+ {included_applications,[]},
233
+ {env,[]},
234
+ {start_phases,[]},
235
+ {maxT,infinity},
236
+ {maxP,infinity},
237
+ {mod,{client_app,[]}}]}]}},
238
+ {progress,applications_loaded},
239
+ {apply,{application,start_boot,[kernel,permanent]}},
240
+ {apply,{application,start_boot,[stdlib,permanent]}},
241
+ {apply,{application,start_boot,[inets,permanent]}},
242
+ {apply,{application,start_boot,[crypto,permanent]}},
243
+ {apply,{application,start_boot,[sasl,permanent]}},
244
+ {apply,{application,start_boot,[client,permanent]}},
245
+ {apply,{c,erlangrc,[]}},
246
+ {progress,started}]}.
@@ -1,4 +1,4 @@
1
- %% script generated at {2008,11,10} {4,29,23}
1
+ %% script generated at {2008,11,10} {16,32,20}
2
2
  {script,
3
3
  {"master","0.1"},
4
4
  [{preLoaded,
@@ -1,4 +1,4 @@
1
- %% script generated at {2008,11,10} {4,29,23}
1
+ %% script generated at {2008,11,10} {16,32,20}
2
2
  {script,
3
3
  {"node","0.1"},
4
4
  [{preLoaded,
@@ -0,0 +1,39 @@
1
+ -module (client_app).
2
+ -behaviour(application).
3
+
4
+ %% Application callbacks
5
+ -export([start/2, stop/1]).
6
+
7
+ %%====================================================================
8
+ %% Application callbacks
9
+ %%====================================================================
10
+ %%--------------------------------------------------------------------
11
+ %% Function: start(Type, StartArgs) -> {ok, Pid} |
12
+ %% {ok, Pid, State} |
13
+ %% {error, Reason}
14
+ %% Description: This function is called whenever an application
15
+ %% is started using application:start/1,2, and should start the processes
16
+ %% of the application. If the application is structured according to the
17
+ %% OTP design principles as a supervision tree, this means starting the
18
+ %% top supervisor of the tree.
19
+ %%--------------------------------------------------------------------
20
+ start(_Type, StartArgs) ->
21
+ case pm_client_supervisor:start_link(StartArgs) of
22
+ {ok, Pid} ->
23
+ {ok, Pid};
24
+ Error ->
25
+ Error
26
+ end.
27
+
28
+ %%--------------------------------------------------------------------
29
+ %% Function: stop(State) -> void()
30
+ %% Description: This function is called whenever an application
31
+ %% has stopped. It is intended to be the opposite of Module:start/2 and
32
+ %% should do any necessary cleaning up. The return value is ignored.
33
+ %%--------------------------------------------------------------------
34
+ stop(_State) ->
35
+ ok.
36
+
37
+ %%====================================================================
38
+ %% Internal functions
39
+ %%====================================================================
@@ -0,0 +1,43 @@
1
+ -module (client_server).
2
+ -include_lib("../include/defines.hrl").
3
+ -export([loop/1, connect_to_master/0]).
4
+ -export ([start/0]).
5
+
6
+ -define (RECONNECT_TIMEOUT, 10000).
7
+
8
+ start() ->
9
+ ?TRACE("MASTER_LOCATION", [?MASTER_LOCATION]),
10
+ connect_to_master(),
11
+ global:sync(),
12
+ pm_client:start(?MODULE, 7050, {?MODULE, loop}).
13
+
14
+ master_server() -> global:whereis_name(pm_master).
15
+
16
+ loop(Socket) ->
17
+ case gen_tcp:recv(Socket, 0) of
18
+ {ok, Data} ->
19
+ ?TRACE("received", [master_server(), erlang:binary_to_list(Data)]),
20
+ % Args = [Item || K <- string:tokens(erlang:binary_to_list(Data), " "), Item <- erlang:list_to_atom(K)],
21
+ [Meth|Args] = string:tokens(erlang:binary_to_list(Data), " "),
22
+ ?TRACE("received", [Meth, Args]),
23
+ Output = gen_server:call(master_server(), {erlang:list_to_atom(Meth), Args}),
24
+ ?TRACE("received from gen_server", [Output]),
25
+ gen_tcp:send(Socket, erlang:float_to_list(Output)),
26
+ io:format("~p~n", [Output]),
27
+ ?TRACE("posted", [Output]),
28
+ loop(Socket);
29
+ {error, closed} ->
30
+ ok
31
+ end.
32
+
33
+ connect_to_master() ->
34
+ case net_adm:ping(?MASTER_LOCATION) of
35
+ pong ->
36
+ ok;
37
+ _ ->
38
+ receive
39
+ stop -> void
40
+ after ?RECONNECT_TIMEOUT ->
41
+ connect_to_master()
42
+ end
43
+ end.
@@ -1,52 +1,49 @@
1
1
  -module (pm_client).
2
- -include_lib("../include/defines.hrl").
3
-
4
- -export ([reconfigure_cloud/0, get_load/1, get_live_nodes/0, start/0]).
5
- -export ([run_cmd/1, fire_cmd/1]).
6
- -export ([provision_orphan_running_servers/0]).
7
- -export ([shutdown/0]).
8
- % Run commands on the running master process
9
- % erl -pa ./ebin/ -run pm_client get_load cpu -run init stop -noshell
10
-
11
- % Connect to the master
12
- start() ->
13
- pong = net_adm:ping(?MASTER_LOCATION),
14
- global:sync().
15
- % Send the command Cmd to the pm_master process
16
- run_cmd(Cmd) ->
17
- Out = pm_master:run_cmd(Cmd),
18
- io:format("~p", [Out]),
19
- Out.
20
- fire_cmd(Cmd) ->
21
- Out = pm_master:fire_cmd(Cmd),
22
- io:format("~p", [Out]),
23
- Out.
24
- % Reconfigure the cloud
25
- reconfigure_cloud() -> pm_master:reconfigure_cloud().
26
- % Get the load on the cloud of type Type
27
- get_load(Type) ->
28
- start(),
29
- Load = pm_master:get_load(Type),
30
- io:format("~p", [Load]),
31
- Load.
32
-
33
- % Check to see if there are servers that are unprovisioned
34
- % And if there are, log in to them and start their messenger
35
- % sending the live code on the master to them
36
- provision_orphan_running_servers() ->
37
- Instances = pm_cluster:any_new_servers(),
38
- case lists:flatlength(Instances) of
39
- 0 ->
40
- ok;
41
- _ ->
42
- utils:distribute_modules_to([pm_node, pm_node_supervisor, pm_event_manager, node_app], Instances),
43
- pm_cluster:slaves(Instances),
44
- Instances
45
- end.
46
-
47
- % Get a list of the live nodes
48
- get_live_nodes() -> pm_master:get_current_nodes().
49
- % Terminate the cloud messenger
50
- % This sends a shutdown to the whole cloud
51
- shutdown() ->
52
- pm_master:shutdown_cloud().
2
+ -behavior(gen_server).
3
+
4
+ -export([init/1, code_change/3, handle_call/3, handle_cast/2, handle_info/2, terminate/2]).
5
+ -export([accept_loop/1]).
6
+ -export([start/3]).
7
+
8
+ -define(TCP_OPTIONS, [binary, {packet, 0}, {active, false}, {reuseaddr, true}]).
9
+
10
+ -record(server_state, {
11
+ port,
12
+ loop,
13
+ ip=any,
14
+ lsocket=null}).
15
+
16
+ start(Name, Port, Loop) ->
17
+ State = #server_state{port = Port, loop = Loop},
18
+ gen_server:start_link({global, Name}, ?MODULE, State, []).
19
+
20
+ init(State = #server_state{port=Port}) ->
21
+ process_flag(trap_exit, true),
22
+ case gen_tcp:listen(Port, ?TCP_OPTIONS) of
23
+ {ok, LSocket} ->
24
+ NewState = State#server_state{lsocket = LSocket},
25
+ {ok, accept(NewState)};
26
+ {error, Reason} ->
27
+ {stop, Reason}
28
+ end.
29
+
30
+ handle_cast({accepted, _Pid}, State=#server_state{}) ->
31
+ {noreply, accept(State)}.
32
+
33
+ accept_loop({Server, LSocket, {M, F}}) ->
34
+ {ok, Socket} = gen_tcp:accept(LSocket),
35
+ % Let the server spawn a new process and replace this loop
36
+ % with the echo loop, to avoid blocking
37
+ gen_server:cast(Server, {accepted, self()}),
38
+ M:F(Socket).
39
+
40
+ % To be more robust we should be using spawn_link and trapping exits
41
+ accept(State = #server_state{lsocket=LSocket, loop = Loop}) ->
42
+ proc_lib:spawn(?MODULE, accept_loop, [{self(), LSocket, Loop}]),
43
+ State.
44
+
45
+ % These are just here to suppress warnings.
46
+ handle_call(_Msg, _Caller, State) -> {noreply, State}.
47
+ handle_info(_Msg, Library) -> {noreply, Library}.
48
+ terminate(_Reason, _Library) -> ok.
49
+ code_change(_OldVersion, Library, _Extra) -> {ok, Library}.
@@ -0,0 +1,52 @@
1
+ -module (pm_client_old).
2
+ -include_lib("../include/defines.hrl").
3
+
4
+ -export ([reconfigure_cloud/0, get_load/1, get_live_nodes/0, start/0]).
5
+ -export ([run_cmd/1, fire_cmd/1]).
6
+ -export ([provision_orphan_running_servers/0]).
7
+ -export ([shutdown/0]).
8
+ % Run commands on the running master process
9
+ % erl -pa ./ebin/ -run pm_client get_load cpu -run init stop -noshell
10
+
11
+ % Connect to the master
12
+ start() ->
13
+ pong = net_adm:ping(?MASTER_LOCATION),
14
+ global:sync().
15
+ % Send the command Cmd to the pm_master process
16
+ run_cmd(Cmd) ->
17
+ Out = pm_master:run_cmd(Cmd),
18
+ io:format("~p", [Out]),
19
+ Out.
20
+ fire_cmd(Cmd) ->
21
+ Out = pm_master:fire_cmd(Cmd),
22
+ io:format("~p", [Out]),
23
+ Out.
24
+ % Reconfigure the cloud
25
+ reconfigure_cloud() -> pm_master:reconfigure_cloud().
26
+ % Get the load on the cloud of type Type
27
+ get_load(Type) ->
28
+ start(),
29
+ Load = pm_master:get_load(Type),
30
+ io:format("~p", [Load]),
31
+ Load.
32
+
33
+ % Check to see if there are servers that are unprovisioned
34
+ % And if there are, log in to them and start their messenger
35
+ % sending the live code on the master to them
36
+ provision_orphan_running_servers() ->
37
+ Instances = pm_cluster:any_new_servers(),
38
+ case lists:flatlength(Instances) of
39
+ 0 ->
40
+ ok;
41
+ _ ->
42
+ utils:distribute_modules_to([pm_node, pm_node_supervisor, pm_event_manager, node_app], Instances),
43
+ pm_cluster:slaves(Instances),
44
+ Instances
45
+ end.
46
+
47
+ % Get a list of the live nodes
48
+ get_live_nodes() -> pm_master:get_current_nodes().
49
+ % Terminate the cloud messenger
50
+ % This sends a shutdown to the whole cloud
51
+ shutdown() ->
52
+ pm_master:shutdown_cloud().
@@ -0,0 +1,38 @@
1
+ % This supervisor is responsible for monitoring the
2
+ % client service
3
+
4
+ -module (pm_client_supervisor).
5
+ -behaviour(supervisor).
6
+
7
+ -export([start/0, start_in_shell_for_testing/0, start_link/1, init/1]).
8
+
9
+ -ifdef(EUNIT).
10
+ -include_lib("eunit/include/eunit.hrl").
11
+ -endif.
12
+
13
+ start() ->
14
+ spawn(fun() ->
15
+ supervisor:start_link({local, ?MODULE}, ?MODULE, _Arg = [])
16
+ end).
17
+
18
+ start_in_shell_for_testing() ->
19
+ {ok, Pid} = supervisor:start_link({local, ?MODULE}, ?MODULE, _Arg = []),
20
+ unlink(Pid).
21
+
22
+ start_link(Args) ->
23
+ supervisor:start_link({local, ?MODULE}, ?MODULE, Args).
24
+
25
+ init([]) ->
26
+ RestartStrategy = one_for_one,
27
+ MaxRestarts = 1000,
28
+ MaxTimeBetRestarts = 3600,
29
+ TimeoutTime = 5000,
30
+
31
+ SupFlags = {RestartStrategy, MaxRestarts, MaxTimeBetRestarts},
32
+
33
+ % Servers
34
+ ClientServer = {client_server1, {client_server, start, []}, permanent, TimeoutTime, worker, [client_server]},
35
+
36
+ LoadServers = [ClientServer],
37
+
38
+ {ok, {SupFlags, LoadServers}}.
@@ -100,11 +100,13 @@ init([]) ->
100
100
  handle_call({get_load, Args}, _From, State) ->
101
101
  Nodes = pm_cluster:get_live_nodes(),
102
102
  List = rpc:multicall(Nodes, pm_node, get_load_for_type, [Args]),
103
- {reply, List, State};
104
- handle_call({get_current_load, Type}, _From, State) ->
103
+ Loads = utils:convert_responses_to_int_list(List),
104
+ {reply, Loads, State};
105
+ handle_call({get_current_load, [Type]}, _From, State) ->
105
106
  LoadForType = get_load_for_type(Type, State),
106
107
  ?TRACE("LoadForType: ",[LoadForType]),
107
- {reply, LoadForType, State};
108
+ Loads = utils:average_of_list(LoadForType),
109
+ {reply, Loads, State};
108
110
  handle_call({get_live_nodes}, _From, State) ->
109
111
  {reply, get_live_nodes(State), State}.
110
112
 
@@ -21,7 +21,7 @@
21
21
  monitors = {} % Tuple of monitors
22
22
  }).
23
23
  -define(SERVER, ?MODULE).
24
- -define (UPDATE_TIME, 2000).
24
+ -define (UPDATE_TIME, 10000).
25
25
 
26
26
  % Client function definitions
27
27
  -export ([stop/0]).
@@ -52,11 +52,14 @@ gen_rel(Name, Vers) ->
52
52
  recompile_scripts(Vers) ->
53
53
  gen_rel("master", Vers),
54
54
  gen_rel("node", Vers),
55
+ gen_rel("client", Vers),
55
56
  systools:make_script("pm_node_rel-"++Vers, [local,{path,["ebin"]}]),
56
- systools:make_script("pm_master_rel-"++Vers, [local,{path,["ebin"]}]).
57
+ systools:make_script("pm_master_rel-"++Vers, [local,{path,["ebin"]}]),
58
+ systools:make_script("pm_client_rel-"++Vers, [local,{path,["ebin"]}]).
57
59
 
58
60
  package_scripts(Vers) ->
59
61
  systools:make_tar("ebin/pm_node_rel-"++Vers),
62
+ systools:make_tar("ebin/pm_client_rel-"++Vers),
60
63
  systools:make_tar("ebin/pm_master_rel-"++Vers).
61
64
 
62
65
  get_vsn(Module) ->
@@ -24,7 +24,7 @@ tick_timer(Time, Fun) ->
24
24
  after Time ->
25
25
  Fun(),
26
26
  tick_timer(Time, Fun)
27
- end.
27
+ end.
28
28
 
29
29
  average_of_list(L) ->
30
30
  Sum = lists:foldr( fun(Int, Sum) -> erlang:list_to_float(Int) + Sum end, 0, [F || F <- L] ),
@@ -77,7 +77,9 @@ module PoolParty
77
77
  # TODO: Update this so it only runs when needed
78
78
  has_exec(:name => "start master messenger", :command => ". /etc/profile && server-start-master", :requires => [get_gempackage("poolparty-latest"), get_exec("build_messenger")], :onlyif => "ps aux | grep beam | grep master")
79
79
 
80
- has_cron({:name => "maintain script", :command => ". /etc/profile && which cloud-maintain | /bin/sh", :minute => "*/3", :requires => [get_gempackage("poolparty-latest"), get_cron("puppetd runner"), get_cron("Load handler"), get_exec("start master messenger"), get_service("haproxy")]})
80
+ has_exec(:name => "start client server", :command => ". /etc/profile && server-start-master", :requires => [get_gempackage("poolparty-latest"), get_exec("build_messenger"), get_exec("start master messenger")], :onlyif => "ps aux | grep beam | grep client")
81
+
82
+ has_cron({:name => "maintain script", :command => ". /etc/profile && which cloud-maintain | /bin/sh", :minute => "*/3", :requires => [get_gempackage("poolparty-latest"), get_cron("puppetd runner"), get_cron("Load handler"), get_exec("start master messenger"), get_service("haproxy"), get_exec("start client server")]})
81
83
 
82
84
  has_remotefile(:name => "/usr/bin/puppetcleaner") do
83
85
  mode 744
@@ -19,7 +19,8 @@ module PoolParty
19
19
  "#{Base.remote_storage_path}/#{Base.default_specfile_name}",
20
20
  ENV["POOL_SPEC"],
21
21
  "#{Base.default_specfile_name}",
22
- "#{Base.storage_directory}/#{Base.default_specfile_name}",
22
+ "#{Base.storage_directory}/#{Base.default_specfile_name}",
23
+ "#{Base.default_project_specfile_name}"
23
24
  ].reject {|a| a.nil?}.reject do |f|
24
25
  f unless ::File.readable?(f)
25
26
  end.first
@@ -7,12 +7,12 @@ module PoolParty
7
7
 
8
8
  # Load a file that contains a pool into memory
9
9
  def load_pool(filename)
10
- filename = filename.chomp
10
+
11
11
  unless filename && ::File.readable?(filename)
12
- puts "Could not load pool: #{filename}"
13
- exit
12
+ puts "Please specify your cloud with -s, move it to ./pool.spec or in your POOL_SPEC environment variable"
13
+ exit(1)
14
14
  else
15
- PoolParty::Script.inflate(open(filename).read, File.dirname(filename))
15
+ PoolParty::Script.inflate(open(filename).read, filename)
16
16
  end
17
17
  end
18
18
 
@@ -46,7 +46,7 @@ module PoolParty
46
46
  opts.separator "Options:"
47
47
 
48
48
  opts.on('-v', '--verbose', 'Be verbose') { self.verbose true }
49
- opts.on('-s [file]', '--spec-file [file]', 'Set the spec file') { |file| self.spec file }
49
+ opts.on('-s [file]', '--spec-file [file]', 'Set the spec file') { |file| self.spec file.chomp }
50
50
  opts.on('-t', '--test', 'Testing mode') { self.testing true }
51
51
 
52
52
  blk.call(opts, self) if blk
@@ -23,7 +23,7 @@ module PoolParty
23
23
  args.each do |arg|
24
24
  (available_monitors << "#{arg}".downcase.to_sym)
25
25
 
26
- InstanceMethods.module_eval "def #{arg}; @#{arg} ||= PoolParty::Messenger.messenger_send!(\"get_load #{arg}\").to_f rescue -1.0; end"
26
+ InstanceMethods.module_eval "def #{arg}; @#{arg} ||= messenger_send!(\"get_current_load #{arg}\").to_f rescue -1.0; end"
27
27
  end
28
28
  end
29
29
 
@@ -6,20 +6,35 @@ module PoolParty
6
6
  Messenger.messenger_send!("reconfigure_cloud")
7
7
  end
8
8
  module Messenger
9
-
9
+ def with_socket(testing=false, &block)
10
+ host = testing ? "localhost" : (master.ip)
11
+ socket = TCPSocket.open(host, 7050)
12
+ out = yield(socket)
13
+ socket.close
14
+ out
15
+ end
10
16
  # TODO: Fix cookie setting
11
- def self.erl_command(hostname, extra="")
12
- command_line_opts = "-pa #{append_dir}/ebin -kernel inet_dist_listen_min 7000 inet_dist_listen_max 7050 -sname #{hostname} -setcookie poolparty"
17
+ def self.erl_command(hostname, extra="", min_ports=7000, max_ports=7050)
18
+ command_line_opts = "-pa #{append_dir}/ebin -kernel inet_dist_listen_min #{min_ports} inet_dist_listen_max #{max_ports} -sname #{hostname} -setcookie poolparty"
13
19
 
14
- "erl #{command_line_opts} #{extra} 2>&1"
20
+ "erl #{command_line_opts} #{extra}"
15
21
  end
16
22
 
17
23
  def self.append_dir
18
24
  ::File.expand_path(::File.join( ::File.dirname(__FILE__), "..", "..", "erlang/messenger" ))
19
25
  end
20
26
 
21
- def self.messenger_send!(cmd="", testing=false)
22
- command = Messenger.erl_command("client#{Time.now.to_i}", "-hidden -s pm_client -run pm_client #{cmd} -s erlang halt -noshell")
27
+ def messenger_send!(msg="get_current_load cpu", testing=false)
28
+ with_socket(testing) do |sock|
29
+ sock.send(msg, 0)
30
+ @str = sock.recv(2000)
31
+ end
32
+ vputs "Received #{@str} from #{msg}"
33
+ @str
34
+ end
35
+
36
+ def self.messenger_send!(cmd="", testing=false)
37
+ command = Messenger.erl_command("client#{Time.now.to_i}", "-s pm_client -run pm_client #{cmd} -s erlang halt -noshell")
23
38
  testing ? command : %x[#{command}]
24
39
  end
25
40
 
@@ -22,6 +22,7 @@ module PoolParty
22
22
  :template_path => "/var/lib/puppet/templates",
23
23
  :module_path => "/etc/puppet/modules/poolparty",
24
24
  :default_specfile_name => "pool.spec",
25
+ :default_project_specfile_name => "spec/pool.spec",
25
26
  :port => "80",
26
27
  :forwarding_port => "8080",
27
28
  :proxy_mode => "http",
@@ -39,7 +39,8 @@ module PoolParty
39
39
  end
40
40
 
41
41
  def plugin_directory(*args)
42
- args.each {|arg| Dir["#{arg}/*/*.rb"].each {|f| require f }}
42
+ args = ["/plugins"] if args.empty?
43
+ args.each {|arg| Dir["#{arg}/*/*.rb"].each {|f| require f rescue "" }}
43
44
  end
44
45
 
45
46
  # This is where the entire process starts
@@ -2,7 +2,7 @@ module PoolParty
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 48
5
+ TINY = 49
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/poolparty.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poolparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.48
4
+ version: 0.2.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Lerner
@@ -71,8 +71,8 @@ executables:
71
71
  - cloud-run
72
72
  - cloud-ssh
73
73
  - cloud-start
74
+ - cloud-stats
74
75
  - cloud-terminate
75
- - messenger-get-load
76
76
  - pool
77
77
  - pool-console
78
78
  - pool-describe
@@ -86,6 +86,7 @@ executables:
86
86
  - server-list-responding
87
87
  - server-rerun
88
88
  - server-show-stats
89
+ - server-start-client
89
90
  - server-start-master
90
91
  - server-start-node
91
92
  extensions: []
@@ -121,8 +122,8 @@ files:
121
122
  - bin/cloud-run
122
123
  - bin/cloud-ssh
123
124
  - bin/cloud-start
125
+ - bin/cloud-stats
124
126
  - bin/cloud-terminate
125
- - bin/messenger-get-load
126
127
  - bin/pool
127
128
  - bin/pool-console
128
129
  - bin/pool-describe
@@ -136,6 +137,7 @@ files:
136
137
  - bin/server-list-responding
137
138
  - bin/server-rerun
138
139
  - bin/server-show-stats
140
+ - bin/server-start-client
139
141
  - bin/server-start-master
140
142
  - bin/server-start-node
141
143
  - config/hoe.rb
@@ -152,6 +154,9 @@ files:
152
154
  - lib/erlang/messenger/README
153
155
  - lib/erlang/messenger/Rakefile
154
156
  - lib/erlang/messenger/control
157
+ - lib/erlang/messenger/ebin/client.app
158
+ - lib/erlang/messenger/ebin/client_app.beam
159
+ - lib/erlang/messenger/ebin/client_server.beam
155
160
  - lib/erlang/messenger/ebin/erl_crash.dump
156
161
  - lib/erlang/messenger/ebin/master.app
157
162
  - lib/erlang/messenger/ebin/master_app.beam
@@ -159,6 +164,9 @@ files:
159
164
  - lib/erlang/messenger/ebin/node_app.beam
160
165
  - lib/erlang/messenger/ebin/packager.app
161
166
  - lib/erlang/messenger/ebin/pm_client.beam
167
+ - lib/erlang/messenger/ebin/pm_client_old.beam
168
+ - lib/erlang/messenger/ebin/pm_client_rel-0.1.rel
169
+ - lib/erlang/messenger/ebin/pm_client_supervisor.beam
162
170
  - lib/erlang/messenger/ebin/pm_cluster.beam
163
171
  - lib/erlang/messenger/ebin/pm_event_manager.beam
164
172
  - lib/erlang/messenger/ebin/pm_master.beam
@@ -227,13 +235,20 @@ files:
227
235
  - lib/erlang/messenger/lib/eunit/src/file_monitor.erl
228
236
  - lib/erlang/messenger/lib/eunit/sys.config
229
237
  - lib/erlang/messenger/lib/eunit/vsn.mk
238
+ - lib/erlang/messenger/log/pool.logs
239
+ - lib/erlang/messenger/pm_client_rel-0.1.boot
240
+ - lib/erlang/messenger/pm_client_rel-0.1.script
230
241
  - lib/erlang/messenger/pm_master_rel-0.1.boot
231
242
  - lib/erlang/messenger/pm_master_rel-0.1.script
232
243
  - lib/erlang/messenger/pm_node_rel-0.1.boot
233
244
  - lib/erlang/messenger/pm_node_rel-0.1.script
245
+ - lib/erlang/messenger/src/client_app.erl
246
+ - lib/erlang/messenger/src/client_server.erl
234
247
  - lib/erlang/messenger/src/master_app.erl
235
248
  - lib/erlang/messenger/src/node_app.erl
236
249
  - lib/erlang/messenger/src/pm_client.erl
250
+ - lib/erlang/messenger/src/pm_client_old.erl
251
+ - lib/erlang/messenger/src/pm_client_supervisor.erl
237
252
  - lib/erlang/messenger/src/pm_cluster.erl
238
253
  - lib/erlang/messenger/src/pm_event_manager.erl
239
254
  - lib/erlang/messenger/src/pm_master.erl
@@ -56,6 +56,24 @@ describe "Console" do
56
56
  reload!
57
57
  end
58
58
  end
59
+ describe "pools" do
60
+ before(:each) do
61
+ @filename = "myspec.spec"
62
+ ::File.stub!(:readable?).with(@filename).and_return true
63
+ @filename.stub!(:read).and_return "spec contents"
64
+ self.stub!(:open).with(@filename).and_return @filename
65
+ end
66
+ it "should call readable on the string sent in to load_pool" do
67
+ lambda {
68
+ ::File.should_receive(:readable?).with(@filename).and_return false
69
+ load_pool(@filename)
70
+ }
71
+ end
72
+ it "should call inflate from Script with the poolspec" do
73
+ PoolParty::Script.should_receive(:inflate).with("spec contents", "myspec.spec")
74
+ load_pool(@filename)
75
+ end
76
+ end
59
77
  describe "print" do
60
78
  before(:each) do
61
79
  reset!
@@ -9,6 +9,9 @@ class TestMonitorClass
9
9
  end
10
10
 
11
11
  describe "Monitors" do
12
+ before(:each) do
13
+ @tmc = TestMonitorClass.new
14
+ end
12
15
  it "should have a list of available monitors" do
13
16
  PoolParty::Monitors.available_monitors.empty?.should == false
14
17
  end
@@ -22,12 +25,12 @@ describe "Monitors" do
22
25
  TestMonitorClass.new.respond_to?(:fake).should == true
23
26
  end
24
27
  it "should call the Messenger with messenger_send!('get_load fake')" do
25
- PoolParty::Messenger.should_receive(:messenger_send!).with("get_load fake").and_return true
26
- TestMonitorClass.new.fake
28
+ @tmc.should_receive(:messenger_send!).with("get_current_load fake").and_return true
29
+ @tmc.fake
27
30
  end
28
31
  it "should have the cpu method on the class" do
29
- PoolParty::Messenger.should_receive(:messenger_send!).with("get_load cpu").and_return true
30
- TestMonitorClass.new.cpu
32
+ @tmc.should_receive(:messenger_send!).with("get_current_load cpu").and_return true
33
+ @tmc.cpu
31
34
  end
32
35
  describe "expansions" do
33
36
  before(:each) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auser-poolparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.48
4
+ version: 0.2.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Lerner
@@ -71,8 +71,8 @@ executables:
71
71
  - cloud-run
72
72
  - cloud-ssh
73
73
  - cloud-start
74
+ - cloud-stats
74
75
  - cloud-terminate
75
- - messenger-get-load
76
76
  - pool
77
77
  - pool-console
78
78
  - pool-describe
@@ -86,6 +86,7 @@ executables:
86
86
  - server-list-responding
87
87
  - server-rerun
88
88
  - server-show-stats
89
+ - server-start-client
89
90
  - server-start-master
90
91
  - server-start-node
91
92
  extensions: []
@@ -121,8 +122,8 @@ files:
121
122
  - bin/cloud-run
122
123
  - bin/cloud-ssh
123
124
  - bin/cloud-start
125
+ - bin/cloud-stats
124
126
  - bin/cloud-terminate
125
- - bin/messenger-get-load
126
127
  - bin/pool
127
128
  - bin/pool-console
128
129
  - bin/pool-describe
@@ -136,6 +137,7 @@ files:
136
137
  - bin/server-list-responding
137
138
  - bin/server-rerun
138
139
  - bin/server-show-stats
140
+ - bin/server-start-client
139
141
  - bin/server-start-master
140
142
  - bin/server-start-node
141
143
  - config/hoe.rb
@@ -152,6 +154,9 @@ files:
152
154
  - lib/erlang/messenger/README
153
155
  - lib/erlang/messenger/Rakefile
154
156
  - lib/erlang/messenger/control
157
+ - lib/erlang/messenger/ebin/client.app
158
+ - lib/erlang/messenger/ebin/client_app.beam
159
+ - lib/erlang/messenger/ebin/client_server.beam
155
160
  - lib/erlang/messenger/ebin/erl_crash.dump
156
161
  - lib/erlang/messenger/ebin/master.app
157
162
  - lib/erlang/messenger/ebin/master_app.beam
@@ -159,6 +164,9 @@ files:
159
164
  - lib/erlang/messenger/ebin/node_app.beam
160
165
  - lib/erlang/messenger/ebin/packager.app
161
166
  - lib/erlang/messenger/ebin/pm_client.beam
167
+ - lib/erlang/messenger/ebin/pm_client_old.beam
168
+ - lib/erlang/messenger/ebin/pm_client_rel-0.1.rel
169
+ - lib/erlang/messenger/ebin/pm_client_supervisor.beam
162
170
  - lib/erlang/messenger/ebin/pm_cluster.beam
163
171
  - lib/erlang/messenger/ebin/pm_event_manager.beam
164
172
  - lib/erlang/messenger/ebin/pm_master.beam
@@ -227,13 +235,20 @@ files:
227
235
  - lib/erlang/messenger/lib/eunit/src/file_monitor.erl
228
236
  - lib/erlang/messenger/lib/eunit/sys.config
229
237
  - lib/erlang/messenger/lib/eunit/vsn.mk
238
+ - lib/erlang/messenger/log/pool.logs
239
+ - lib/erlang/messenger/pm_client_rel-0.1.boot
240
+ - lib/erlang/messenger/pm_client_rel-0.1.script
230
241
  - lib/erlang/messenger/pm_master_rel-0.1.boot
231
242
  - lib/erlang/messenger/pm_master_rel-0.1.script
232
243
  - lib/erlang/messenger/pm_node_rel-0.1.boot
233
244
  - lib/erlang/messenger/pm_node_rel-0.1.script
245
+ - lib/erlang/messenger/src/client_app.erl
246
+ - lib/erlang/messenger/src/client_server.erl
234
247
  - lib/erlang/messenger/src/master_app.erl
235
248
  - lib/erlang/messenger/src/node_app.erl
236
249
  - lib/erlang/messenger/src/pm_client.erl
250
+ - lib/erlang/messenger/src/pm_client_old.erl
251
+ - lib/erlang/messenger/src/pm_client_supervisor.erl
237
252
  - lib/erlang/messenger/src/pm_cluster.erl
238
253
  - lib/erlang/messenger/src/pm_event_manager.erl
239
254
  - lib/erlang/messenger/src/pm_master.erl
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
- require "poolparty"
4
- require "poolpartycl"
5
-
6
- available_monitors = PoolParty::Monitors.available_monitors
7
- o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
8
- opts.on('-n name', '--name name', 'Listing for cloud name') { |c| optioner.cloudname c }
9
- opts.on('-m name', '--monitor monitor_name', "Monitor name (default: cpu) (Available monitors: #{available_monitors.join(", ")})") {|c| optioner.monitorname c}
10
- end
11
-
12
- load_pool(o.spec || Binary.get_existing_spec_location)
13
-
14
- include Remote
15
-
16
- @clouds = extract_cloud_from_options o
17
- @monitor = o.monitorname || "cpu"
18
-
19
- @clouds.each do |cl|
20
-
21
- with_cloud(cl, {:testing => o.testing, :monitorname => @monitor, :verbose => o.verbose }) do
22
- vputs "Getting #{monitorname} load through the messenger"
23
- load = PoolParty::Messenger.messenger_send!("get_load #{monitorname}", testing)
24
- msg = load =~ /[0-9\.]+/ ? load : "-1"
25
- print msg
26
- end
27
-
28
- end