Sha256: b05927fcfbb65fa47595017512b5432279475083bcb13666829a033f5bb58002

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 KB

Contents

-module (pm_client).
-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_cluster:get_live_nodes().
% Terminate the cloud messenger
% This sends a shutdown to the whole cloud
shutdown() -> 
	pm_master:shutdown_cloud().

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
auser-poolparty-0.2.36 lib/erlang/messenger/src/pm_client.erl
auser-poolparty-0.2.37 lib/erlang/messenger/src/pm_client.erl
auser-poolparty-0.2.38 lib/erlang/messenger/src/pm_client.erl
auser-poolparty-0.2.39 lib/erlang/messenger/src/pm_client.erl
auser-poolparty-0.2.40 lib/erlang/messenger/src/pm_client.erl
auser-poolparty-0.2.41 lib/erlang/messenger/src/pm_client.erl
auser-poolparty-0.2.42 lib/erlang/messenger/src/pm_client.erl
auser-poolparty-0.2.44 lib/erlang/messenger/src/pm_client.erl
auser-poolparty-0.2.45 lib/erlang/messenger/src/pm_client.erl
auser-poolparty-0.2.46 lib/erlang/messenger/src/pm_client.erl
auser-poolparty-0.2.47 lib/erlang/messenger/src/pm_client.erl