Sha256: 984666be82395cd9cd8f0e3078800d03441441765d45e0d9fb8d5d6eb50b0e1d

Contents?: true

Size: 1.5 KB

Versions: 30

Compression:

Stored size: 1.5 KB

Contents

-module (pm_client_old).
-include_lib("../include/defines.hrl").

-export ([reconfigure_cloud/0, get_load/1, get_live_nodes/0, start/0]).
-export ([run_cmd/1, fire_cmd/1]).
-export ([provision_orphan_running_servers/0]).
-export ([shutdown/0]).
% Run commands on the running master process
% erl -pa ./ebin/ -run pm_client get_load cpu -run init stop -noshell

% Connect to the master
start() -> 
	pong = net_adm:ping(?MASTER_LOCATION),
	global:sync().
% Send the command Cmd to the pm_master process
run_cmd(Cmd) ->	
	Out = pm_master:run_cmd(Cmd),
	io:format("~p", [Out]),
	Out.
fire_cmd(Cmd) ->	
	Out = pm_master:fire_cmd(Cmd),
	io:format("~p", [Out]),
	Out.
% Reconfigure the cloud
reconfigure_cloud() -> pm_master:reconfigure_cloud().
% Get the load on the cloud of type Type
get_load(Type) -> 
	start(),
	Load = pm_master:get_load(Type),
	io:format("~p", [Load]),
	Load.
	
% Check to see if there are servers that are unprovisioned
% And if there are, log in to them and start their messenger
% sending the live code on the master to them
provision_orphan_running_servers() ->
	Instances = pm_cluster:any_new_servers(),
	case lists:flatlength(Instances) of
		0 ->
			ok;
		_ ->
			utils:distribute_modules_to([pm_node, pm_node_supervisor, pm_event_manager, node_app], Instances),
			pm_cluster:slaves(Instances),
			Instances
	end.

% Get a list of the live nodes
get_live_nodes() -> pm_master:get_current_nodes().
% Terminate the cloud messenger
% This sends a shutdown to the whole cloud
shutdown() -> 
	pm_master:shutdown_cloud().

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
auser-poolparty-0.2.49 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.50 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.51 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.52 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.53 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.54 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.55 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.56 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.57 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.58 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.59 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.60 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.61 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.62 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.63 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.64 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.65 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.66 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.67 lib/erlang/messenger/src/pm_client_old.erl
auser-poolparty-0.2.68 lib/erlang/messenger/src/pm_client_old.erl