use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.
the class RMCore method defineNodeSource.
/**
* {@inheritDoc}
*/
@Override
public BooleanWrapper defineNodeSource(String nodeSourceName, String infrastructureType, Object[] infraParams, String policyType, Object[] policyParams, boolean nodesRecoverable) {
this.validateNodeSourceNameOrFail(nodeSourceName);
nodeSourceName = nodeSourceName.trim();
logger.info("Define node source " + nodeSourceName + REQUESTED_BY_STRING + this.caller.getName());
NodeSourceDescriptor nodeSourceDescriptor = this.persistNodeSourceAndGetDescriptor(nodeSourceName, infrastructureType, infraParams, policyType, policyParams, nodesRecoverable);
NodeSource nodeSource = this.createNodeSourceInstance(nodeSourceDescriptor);
this.definedNodeSources.put(nodeSourceName, nodeSource);
this.monitoring.nodeSourceEvent(new RMNodeSourceEvent(RMEventType.NODESOURCE_DEFINED, this.caller.getName(), nodeSourceName, nodeSource.getDescription(), nodeSourceDescriptor.getProvider().getName(), nodeSource.getStatus().toString()));
logger.info(NODE_SOURCE_STRING + nodeSourceName + " has been successfully defined");
return new BooleanWrapper(true);
}
use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.
the class RMCore method removeNode.
public BooleanWrapper removeNode(String nodeUrl, boolean preempt, boolean isTriggeredFromShutdownHook) {
// if we get a "deploying node url" we change the flow
if (RMNodeHelper.isDeployingNodeURL(nodeUrl)) {
RMNode deployingNode = getNodeByUrlIncludingDeployingNodes(nodeUrl);
if (!isTriggeredFromShutdownHook && deployingNode != null && deployingNode.isLocked()) {
dbManager.createLockEntryOrUpdate(deployingNode.getNodeSourceName(), RMDBManager.NodeLockUpdateAction.DECREMENT);
}
return new BooleanWrapper(removeDeployingNode(nodeUrl));
}
if (this.allNodes.containsKey(nodeUrl)) {
RMNode rmnode = this.allNodes.get(nodeUrl);
logger.debug("Request to remove node " + rmnode);
// checking if the caller is the node administrator
checkNodeAdminPermission(rmnode, caller);
if (!isTriggeredFromShutdownHook && rmnode.isLocked()) {
dbManager.createLockEntryOrUpdate(rmnode.getNodeSourceName(), RMDBManager.NodeLockUpdateAction.DECREMENT);
}
if (rmnode.isDown() || preempt || rmnode.isFree() || rmnode.isLocked()) {
removeNodeFromCoreAndSource(rmnode, caller);
} else if (rmnode.isBusy() || rmnode.isConfiguring()) {
internalSetToRemove(rmnode, caller);
}
} else {
logger.warn("An attempt to remove a non existing node: " + nodeUrl + " was made. Ignoring it");
return new BooleanWrapper(false);
}
return new BooleanWrapper(true);
}
use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.
the class NodeSource method removeNode.
/**
* Removes the node from the node source.
*
* @param nodeUrl the url of the node to be released
*/
public BooleanWrapper removeNode(String nodeUrl, Client initiator) {
// node could have fallen between remove request and the confirm
if (this.nodes.containsKey(nodeUrl)) {
logger.info("[" + name + "] removing node : " + nodeUrl);
Node node = nodes.remove(nodeUrl);
RMCore.topologyManager.removeNode(node);
try {
infrastructureManager.internalRemoveNode(node);
} catch (RMException e) {
logger.error(e.getCause().getMessage(), e);
}
} else {
Node downNode = downNodes.remove(nodeUrl);
if (downNode != null) {
logger.info("[" + name + "] removing down node : " + nodeUrl);
} else {
logger.error("[" + name + "] removing node : " + nodeUrl + " which not belongs to this node source");
return new BooleanWrapper(false);
}
}
if (this.toShutdown && this.nodes.size() == 0) {
this.shutdownNodeSourceServices(initiator);
}
return new BooleanWrapper(true);
}
use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.
the class CronPolicy method configure.
/**
* Configure a policy with given parameters.
* @param policyParameters parameters defined by user
*/
@Override
public BooleanWrapper configure(Object... policyParameters) {
super.configure(policyParameters);
try {
cronScheduler = new Scheduler();
int index = 2;
nodeAcquision = policyParameters[index++].toString();
nodeRemoval = policyParameters[index++].toString();
preemptive = Boolean.parseBoolean(policyParameters[index++].toString());
forceDeployment = Boolean.parseBoolean(policyParameters[index++].toString());
} catch (Throwable t) {
throw new IllegalArgumentException(t);
}
return new BooleanWrapper(true);
}
use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.
the class ReleaseResourcesWhenSchedulerIdle method configure.
/**
* Configure a policy with given parameters.
* @param policyParameters parameters defined by user
*/
@Override
public BooleanWrapper configure(Object... policyParameters) {
super.configure(policyParameters);
try {
timer = new Timer("ReleaseResourcesWhenSchedulerIdle Timer(1)", true);
idleTime = Long.parseLong(policyParameters[6].toString());
} catch (RuntimeException e) {
throw new IllegalArgumentException(e);
}
return new BooleanWrapper(true);
}
Aggregations