@PublicAPI public class RMNodeClient extends Object implements IRMClient, Serializable
Constructor and Description |
---|
RMNodeClient(CredData userCreds,
String schedulerRestUrl) |
Modifier and Type | Method and Description |
---|---|
Set<String> |
acquireNodes(String sourceName,
int numberNodes,
boolean synchronous,
long timeout,
String nodeConfigJson)
Acquire new nodes of a specified node source
|
boolean |
addNode(String url,
String nodesource)
Adds an existing node to the particular node source.
|
void |
addNodeToken(String nodeUrl,
String token)
Add access token to given node
|
void |
connect() |
void |
connect(String url) |
NSState |
createNodeSource(String nodeSourceName,
String infrastructureType,
String[] infrastructureParameters,
String[] infrastructureFileParameters,
String policyType,
String[] policyParameters,
String[] policyFileParameters)
Deprecated.
As of version 8.1, replaced by
defineNodeSource(String, String, String[], String[],
String, String[], String[], String) and deployNodeSource(String) |
NSState |
createNodeSource(String nodeSourceName,
String infrastructureType,
String[] infrastructureParameters,
String[] infrastructureFileParameters,
String policyType,
String[] policyParameters,
String[] policyFileParameters,
String nodesRecoverable)
Deprecated.
As of version 8.1, replaced by
defineNodeSource(String,String, String[], String[],
String, String[], String[], String) and deployNodeSource(String)
Create a NodeSource
|
NSState |
defineNodeSource(String nodeSourceName,
String infrastructureType,
String[] infrastructureParameters,
String[] infrastructureFileParameters,
String policyType,
String[] policyParameters,
String[] policyFileParameters,
String nodesRecoverable) |
NSState |
deployNodeSource(String nodeSourceName)
Start the nodes acquisition of the node source
|
void |
disconnect()
Disconnects from resource manager and releases all the nodes taken by
user for computations.
|
NSState |
editNodeSource(String nodeSourceName,
String infrastructureType,
String[] infrastructureParameters,
String[] infrastructureFileParameters,
String policyType,
String[] policyParameters,
String[] policyFileParameters,
String nodesRecoverable) |
ScriptResult<Object> |
executeHostScript(String host,
String script,
String scriptEngine) |
ScriptResult<Object> |
executeNodeScript(String nodeUrl,
String script,
String scriptEngine) |
List<ScriptResult<Object>> |
executeNodeSourceScript(String nodeSource,
String script,
String scriptEngine) |
ConnectionInfo |
getConnectionInfo()
Returns the connection info, if initialized previously
|
List<RMNodeSourceEvent> |
getExistingNodeSources() |
Map<String,List<String>> |
getInfrasToPoliciesMapping() |
Object |
getMBeanInfo(ObjectName name,
List<String> attrs)
Returns the attributes
attr of the mbean
registered as name . |
String |
getNodeMBeanHistory(String nodeJmxUrl,
String objectName,
List<String> attrs,
String range)
Return the statistic history contained in the node RRD database,
without redundancy, in a friendly JSON format.
|
Object |
getNodeMBeanInfo(String nodeJmxUrl,
String objectName,
List<String> attrs)
Retrieves attributes of the specified mbean.
|
Object |
getNodeMBeansHistory(String nodeJmxUrl,
String objectNames,
List<String> attrs,
String range) |
Object |
getNodeMBeansInfo(String nodeJmxUrl,
String objectNames,
List<String> attrs)
Retrieves attributes of the specified mbeans.
|
Map<String,Map<String,Map<String,List<RMNodeHistory>>>> |
getNodesHistory(long windowStart,
long windowEnd) |
Map<String,Map<String,Object>> |
getNodesMBeanHistory(List<String> nodesJmxUrl,
String objectName,
List<String> attrs,
String range)
Return the statistic history of a list of nodes contained in the node RRD database,
without redundancy, in a friendly JSON format.
|
NodeSourceConfiguration |
getNodeSourceConfiguration(String nodeSourceName) |
int |
getNodeSourcePingFrequency(String sourceName)
Returns the ping frequency of a node source
|
String |
getNodeThreadDump(String nodeUrl) |
RMStateDelta |
getRMStateDelta(String clientCounter)
Returns difference between current state of the resource manager
and state that the client is aware of.
|
RMStateFull |
getRMStateFull()
Returns the full state of the RM, which does not include REMOVED node/nodesources
|
String |
getRMThreadDump() |
String |
getSession()
Retrieves the current session identifier, or null if the session was not initialized yet.
|
RMState |
getState() |
String |
getStatHistory(String range)
Return the statistic history contained in the RM's RRD database,
without redundancy, in a friendly JSON format.
|
Collection<PluginDescriptorData> |
getSupportedNodeSourceInfrastructures() |
Collection<PluginDescriptorData> |
getSupportedNodeSourcePolicies() |
TopologyData |
getTopology() |
String |
getVersion() |
void |
init(ConnectionInfo connectionInfo)
Initialize this instance.
|
boolean |
isActive() |
boolean |
lockNodes(Set<String> nodeUrls)
prevent other users from using a set of locked nodes
|
boolean |
nodeIsAvailable(String url) |
boolean |
releaseNode(String url)
Release a node
|
boolean |
removeNode(String nodeUrl,
boolean preempt)
Delete a node
|
boolean |
removeNodeSource(String sourceName,
boolean preempt)
Delete a nodesource
|
void |
removeNodeToken(String nodeUrl,
String token)
Remove access token from given node
|
void |
setMBeanInfo(ObjectName name,
String type,
String attr,
String value)
Set a single JMX attribute of the MBean
name . |
void |
setNodeTokens(String nodeUrl,
List<String> tokens)
Set all node tokens to given node
|
void |
setSession(String sid)
Sets the session identifier explicitly.
|
boolean |
shutdown(boolean preempt)
Initiate the shutdowns the resource manager.
|
NSState |
undeployNodeSource(String nodeSourceName,
boolean preempt)
Remove the nodes of the node source and keep the node source undeployed
|
boolean |
unlockNodes(Set<String> nodeUrls)
allow other users to use a set of previously locked nodes
|
NSState |
updateDynamicParameters(String nodeSourceName,
String infrastructureType,
String[] infrastructureParameters,
String[] infrastructureFileParameters,
String policyType,
String[] policyParameters,
String[] policyFileParameters) |
public void init(ConnectionInfo connectionInfo) throws Exception
IRMClient
public ConnectionInfo getConnectionInfo()
IRMClient
getConnectionInfo
in interface IRMClient
public void setSession(String sid)
IRMClient
setSession
in interface IRMClient
sid
- session identifierpublic String getSession()
IRMClient
getSession
in interface IRMClient
public void disconnect() throws NotConnectedException
NotConnectedException
public RMState getState() throws NotConnectedException
NotConnectedException
public RMStateDelta getRMStateDelta(String clientCounter) throws NotConnectedException, PermissionRestException
clientCounter
- (optional) is the latest counter client has, if parameter is not provided then
method returns all eventsNotConnectedException
PermissionRestException
public RMStateFull getRMStateFull() throws NotConnectedException, PermissionRestException
NotConnectedException
PermissionRestException
public boolean isActive() throws NotConnectedException
NotConnectedException
public boolean addNode(String url, String nodesource) throws NotConnectedException
url
- the url of the nodenodesource
- the node source, can be nullNotConnectedException
public Set<String> acquireNodes(String sourceName, int numberNodes, boolean synchronous, long timeout, String nodeConfigJson) throws NotConnectedException, RestException
sourceName
- the name of the node sourcenumberNodes
- the number of nodes to be acquiredsynchronous
- whether the request is synchronous or asynchronous, when true, the request returns the url of acquired nodes after the nodes are successfully deployed.timeout
- the maximum duration of the request, in seconds.nodeConfigJson
- the specific configuration of nodes to be acquired, in json formatNotConnectedException
RestException
public boolean nodeIsAvailable(String url) throws NotConnectedException
url
- the url of the nodeNotConnectedException
public List<RMNodeSourceEvent> getExistingNodeSources() throws NotConnectedException, PermissionRestException
NotConnectedException
PermissionRestException
public NSState defineNodeSource(String nodeSourceName, String infrastructureType, String[] infrastructureParameters, String[] infrastructureFileParameters, String policyType, String[] policyParameters, String[] policyFileParameters, String nodesRecoverable) throws NotConnectedException
NotConnectedException
public NSState editNodeSource(String nodeSourceName, String infrastructureType, String[] infrastructureParameters, String[] infrastructureFileParameters, String policyType, String[] policyParameters, String[] policyFileParameters, String nodesRecoverable) throws NotConnectedException
NotConnectedException
public NSState updateDynamicParameters(String nodeSourceName, String infrastructureType, String[] infrastructureParameters, String[] infrastructureFileParameters, String policyType, String[] policyParameters, String[] policyFileParameters) throws NotConnectedException, PermissionRestException
public NSState createNodeSource(String nodeSourceName, String infrastructureType, String[] infrastructureParameters, String[] infrastructureFileParameters, String policyType, String[] policyParameters, String[] policyFileParameters) throws NotConnectedException, PermissionRestException
defineNodeSource(String, String, String[], String[],
String, String[], String[], String)
and deployNodeSource(String)
public NSState createNodeSource(String nodeSourceName, String infrastructureType, String[] infrastructureParameters, String[] infrastructureFileParameters, String policyType, String[] policyParameters, String[] policyFileParameters, String nodesRecoverable) throws NotConnectedException
defineNodeSource(String,String, String[], String[],
String, String[], String[], String)
and deployNodeSource(String)
Create a NodeSource
nodeSourceName
- name of the node source to createinfrastructureType
- fully qualified class name of the infrastructure to createinfrastructureParameters
- String parameters of the infrastructure, without the
parameters containing files or credentialsinfrastructureFileParameters
- File or credential parameterspolicyType
- fully qualified class name of the policy to createpolicyParameters
- String parameters of the policy, without the parameters
containing files or credentialspolicyFileParameters
- File or credential parametersnodesRecoverable
- Whether the nodes can be recovered after a crash of the RMNotConnectedException
public NSState deployNodeSource(String nodeSourceName) throws NotConnectedException, PermissionRestException
nodeSourceName
- the name of the node source to startNotConnectedException
PermissionRestException
public NSState undeployNodeSource(String nodeSourceName, boolean preempt) throws NotConnectedException, PermissionRestException
nodeSourceName
- the name of the node source to undeployNotConnectedException
PermissionRestException
public int getNodeSourcePingFrequency(String sourceName) throws NotConnectedException, PermissionRestException
sourceName
- a node sourceNotConnectedException
PermissionRestException
public boolean releaseNode(String url) throws RMNodeException, NotConnectedException, PermissionRestException
url
- node's URLRMNodeException
NotConnectedException
PermissionRestException
public boolean removeNode(String nodeUrl, boolean preempt) throws NotConnectedException, PermissionRestException
nodeUrl
- node's URLpreempt
- if true remove node source immediatly whithout waiting for nodes to be freedNotConnectedException
PermissionRestException
public boolean removeNodeSource(String sourceName, boolean preempt) throws NotConnectedException, PermissionRestException
sourceName
- a node sourcepreempt
- if true remove node source immediatly whithout waiting for nodes to be freedNotConnectedException
PermissionRestException
public boolean lockNodes(Set<String> nodeUrls) throws NotConnectedException, PermissionRestException
nodeUrls
- set of node urls to lockNotConnectedException
PermissionRestException
public boolean unlockNodes(Set<String> nodeUrls) throws NotConnectedException, PermissionRestException
nodeUrls
- set of node urls to unlockNotConnectedException
PermissionRestException
public Object getNodeMBeanInfo(String nodeJmxUrl, String objectName, List<String> attrs) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, NotConnectedException, MalformedObjectNameException, NullPointerException, PermissionRestException
nodeJmxUrl
- mbean server urlobjectName
- name of mbeanattrs
- set of mbean attributesInstanceNotFoundException
IntrospectionException
ReflectionException
IOException
NotConnectedException
MalformedObjectNameException
NullPointerException
PermissionRestException
public String getNodeMBeanHistory(String nodeJmxUrl, String objectName, List<String> attrs, String range) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, NotConnectedException, MalformedObjectNameException, NullPointerException, MBeanException
nodeJmxUrl
- mbean server urlobjectName
- name of mbeanattrs
- set of mbean attributesrange
- a String of 5 chars, one for each stat history source, indicating the time range to fetch
for each source. Each char can be:InstanceNotFoundException
IntrospectionException
ReflectionException
IOException
NotConnectedException
MalformedObjectNameException
NullPointerException
MBeanException
public Map<String,Map<String,Object>> getNodesMBeanHistory(List<String> nodesJmxUrl, String objectName, List<String> attrs, String range) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, NotConnectedException, MalformedObjectNameException, NullPointerException, MBeanException
nodesJmxUrl
- a set of mbean server urlsobjectName
- name of mbeanattrs
- set of mbean attributesrange
- a String of 5 chars, one for each stat history source, indicating the time range to fetch
for each source. Each char can be:InstanceNotFoundException
IntrospectionException
ReflectionException
IOException
NotConnectedException
MalformedObjectNameException
NullPointerException
MBeanException
public Object getNodeMBeansInfo(String nodeJmxUrl, String objectNames, List<String> attrs) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, NotConnectedException, MalformedObjectNameException, NullPointerException, PermissionRestException
objectNames
- mbean names (@see ObjectName format)nodeJmxUrl
- mbean server urlattrs
- set of mbean attributesInstanceNotFoundException
IntrospectionException
ReflectionException
IOException
NotConnectedException
MalformedObjectNameException
NullPointerException
PermissionRestException
public Object getNodeMBeansHistory(String nodeJmxUrl, String objectNames, List<String> attrs, String range) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, NotConnectedException, MalformedObjectNameException, NullPointerException, MBeanException, PermissionRestException
public boolean shutdown(boolean preempt) throws NotConnectedException, PermissionRestException
preempt
- if true shutdown immediatly whithout waiting for nodes to be freed, default value is falseNotConnectedException
PermissionRestException
public TopologyData getTopology() throws NotConnectedException, PermissionRestException
public Collection<PluginDescriptorData> getSupportedNodeSourceInfrastructures() throws NotConnectedException, PermissionRestException
NotConnectedException
PermissionRestException
public Map<String,List<String>> getInfrasToPoliciesMapping() throws NotConnectedException, PermissionRestException
NotConnectedException
PermissionRestException
public Collection<PluginDescriptorData> getSupportedNodeSourcePolicies() throws NotConnectedException, PermissionRestException
NotConnectedException
PermissionRestException
public NodeSourceConfiguration getNodeSourceConfiguration(String nodeSourceName) throws NotConnectedException, PermissionRestException
public Object getMBeanInfo(ObjectName name, List<String> attrs) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, NotConnectedException, PermissionRestException
attr
of the mbean
registered as name
.name
- mbean's object nameattrs
- attributes to enumerateInstanceNotFoundException
IntrospectionException
ReflectionException
IOException
NotConnectedException
PermissionRestException
public void setMBeanInfo(ObjectName name, String type, String attr, String value) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, NotConnectedException, MBeanException, InvalidAttributeValueException, AttributeNotFoundException
name
.
Only integer and string attributes are currently supported, see type
.name
- the object name of the MBeantype
- the type of the attribute to set ('integer' and 'string' are currently supported, see RMProxyUserInterface
)attr
- the name of the attribute to setvalue
- the new value of the attribute (defined as a String, it is automatically converted according to type
)InstanceNotFoundException
IntrospectionException
ReflectionException
IOException
NotConnectedException
MBeanException
InvalidAttributeValueException
AttributeNotFoundException
public String getStatHistory(String range) throws ReflectionException, InterruptedException, IntrospectionException, NotConnectedException, InstanceNotFoundException, MalformedObjectNameException, IOException
{ AvailableNodesCount", "FreeNodesCount", "NeededNodesCount", "BusyNodesCount", "DeployingNodesCount", "ConfigNodesCount", "DownNodesCount", "LostNodesCount", "AverageActivity" };
range
- a String of 9 chars, one for each stat history source, indicating the time range to fetch
for each source. Each char can be:ReflectionException
InterruptedException
IntrospectionException
NotConnectedException
InstanceNotFoundException
MalformedObjectNameException
IOException
public String getVersion()
public ScriptResult<Object> executeNodeScript(String nodeUrl, String script, String scriptEngine) throws Throwable
Throwable
public List<ScriptResult<Object>> executeNodeSourceScript(String nodeSource, String script, String scriptEngine) throws Throwable
Throwable
public ScriptResult<Object> executeHostScript(String host, String script, String scriptEngine) throws Throwable
Throwable
public String getRMThreadDump() throws NotConnectedException
NotConnectedException
public String getNodeThreadDump(String nodeUrl) throws NotConnectedException
NotConnectedException
public Map<String,Map<String,Map<String,List<RMNodeHistory>>>> getNodesHistory(long windowStart, long windowEnd) throws NotConnectedException
NotConnectedException
public void addNodeToken(String nodeUrl, String token) throws NotConnectedException, RestException
token
- single tokenNotConnectedException
RestException
public void removeNodeToken(String nodeUrl, String token) throws NotConnectedException, RestException
token
- single tokenNotConnectedException
RestException
public void setNodeTokens(String nodeUrl, List<String> tokens) throws NotConnectedException, RestException
NotConnectedException
RestException