Search in sources :

Example 1 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class RMCore method updateNodeSourceDescriptorWithStatusAndPersist.

private void updateNodeSourceDescriptorWithStatusAndPersist(NodeSourceDescriptor descriptor, NodeSourceStatus status) {
    descriptor.setStatus(status);
    NodeSourceData nodeSourceData = NodeSourceData.fromNodeSourceDescriptor(descriptor);
    this.dbManager.updateNodeSource(nodeSourceData);
}
Also used : NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData)

Example 2 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class RMCore method persistNodeSourceAndGetDescriptor.

private NodeSourceDescriptor persistNodeSourceAndGetDescriptor(String nodeSourceName, String infrastructureType, Object[] infraParams, String policyType, Object[] policyParams, boolean nodesRecoverable) {
    List<Serializable> serializableInfraParams = this.getSerializableParamsOrFail(infraParams);
    List<Serializable> serializablePolicyParams = this.getSerializableParamsOrFail(policyParams);
    NodeSourceData persistedNodeSource = new NodeSourceData(nodeSourceName, infrastructureType, serializableInfraParams, policyType, serializablePolicyParams, this.caller, nodesRecoverable, NodeSourceStatus.NODES_UNDEPLOYED);
    boolean success = this.dbManager.addNodeSource(persistedNodeSource);
    if (!success) {
        this.dbManager.removeNodeSource(nodeSourceName);
    }
    return persistedNodeSource.toNodeSourceDescriptor();
}
Also used : Serializable(java.io.Serializable) NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData)

Example 3 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class RMCore method editNodeSource.

/**
 * {@inheritDoc}
 */
@Override
public BooleanWrapper editNodeSource(String nodeSourceName, String infrastructureType, Object[] infraParams, String policyType, Object[] policyParams, boolean nodesRecoverable) {
    logger.info("Edit node source " + nodeSourceName + REQUESTED_BY_STRING + this.caller.getName());
    NodeSource oldNodeSource = this.getEditableNodeSourceOrFail(nodeSourceName);
    NodeSourceData nodeSourceData = this.getNodeSourceToPersist(nodeSourceName, infrastructureType, infraParams, policyType, policyParams, nodesRecoverable);
    this.dbManager.updateNodeSource(nodeSourceData);
    try {
        NodeSource newNodeSource = this.createNodeSourceInstance(nodeSourceData.toNodeSourceDescriptor());
        this.definedNodeSources.put(nodeSourceName, newNodeSource);
        this.emitNodeSourceEvent(newNodeSource, RMEventType.NODESOURCE_DEFINED);
        logger.info(NODE_SOURCE_STRING + nodeSourceName + " has been successfully edited");
        return new BooleanWrapper(true);
    } catch (Exception e) {
        this.dbManager.updateNodeSource(NodeSourceData.fromNodeSourceDescriptor(oldNodeSource.getDescriptor()));
        this.definedNodeSources.put(nodeSourceName, oldNodeSource);
        logger.warn(NODE_SOURCE_STRING + nodeSourceName + " failed to be edited. Infrastructure parameters: " + Arrays.toString(infraParams) + ". Policy parameters: " + Arrays.toString(policyParams) + ".", e);
        throw e;
    }
}
Also used : NodeSource(org.ow2.proactive.resourcemanager.nodesource.NodeSource) BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData) RMException(org.ow2.proactive.resourcemanager.exception.RMException) NodeException(org.objectweb.proactive.core.node.NodeException) ScriptException(org.ow2.proactive.scripting.ScriptException) PluginNotFoundException(org.ow2.proactive.resourcemanager.nodesource.PluginNotFoundException) TopologyException(org.ow2.proactive.resourcemanager.frontend.topology.TopologyException) ActiveObjectCreationException(org.objectweb.proactive.ActiveObjectCreationException) URISyntaxException(java.net.URISyntaxException) ThreadDumpNotAccessibleException(org.ow2.proactive.resourcemanager.rmnode.ThreadDumpNotAccessibleException) AddingNodesException(org.ow2.proactive.resourcemanager.exception.AddingNodesException) NotConnectedException(org.ow2.proactive.resourcemanager.exception.NotConnectedException) ProActiveException(org.objectweb.proactive.core.ProActiveException)

Example 4 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class NodesRecoveryManager method recoverNodeSourcesAndNodes.

public void recoverNodeSourcesAndNodes() {
    Collection<NodeSourceData> nodeSources = this.rmCore.getDbManager().getNodeSources();
    this.logPersistedNodeSourceInfo(nodeSources);
    for (NodeSourceData nodeSourceData : nodeSources) {
        String nodeSourceName = nodeSourceData.getName();
        if (RMConstants.DEFAULT_LOCAL_NODES_NODE_SOURCE_NAME.equals(nodeSourceName)) {
            // will be recreated by SchedulerStarter
            this.rmCore.getDbManager().removeNodeSource(nodeSourceName);
        } else {
            this.recoverNodeSourceSuccessfullyOrRemove(nodeSourceData, nodeSourceName);
        }
    }
}
Also used : NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData)

Example 5 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class NodeSourcesTest method createNodeSource.

private NodeSourceData createNodeSource() {
    List<Serializable> infraParams = new ArrayList<>(1);
    infraParams.add("infrastructure");
    List<Serializable> policyParams = new ArrayList<>(1);
    policyParams.add("policy");
    return new NodeSourceData("ns1", DefaultInfrastructureManager.class.getName(), infraParams, StaticPolicy.class.getName(), policyParams, new Client(null, false), false, NodeSourceStatus.NODES_DEPLOYED, null);
}
Also used : Serializable(java.io.Serializable) DefaultInfrastructureManager(org.ow2.proactive.resourcemanager.nodesource.infrastructure.DefaultInfrastructureManager) StaticPolicy(org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy) NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData) Client(org.ow2.proactive.resourcemanager.authentication.Client)

Aggregations

NodeSourceData (org.ow2.proactive.resourcemanager.db.NodeSourceData)17 Test (org.junit.Test)6 Serializable (java.io.Serializable)4 RMNodeData (org.ow2.proactive.resourcemanager.db.RMNodeData)4 ProActiveTest (org.ow2.tests.ProActiveTest)4 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)2 NodeSource (org.ow2.proactive.resourcemanager.nodesource.NodeSource)2 DefaultInfrastructureManager (org.ow2.proactive.resourcemanager.nodesource.infrastructure.DefaultInfrastructureManager)2 StaticPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy)2 URISyntaxException (java.net.URISyntaxException)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 ActiveObjectCreationException (org.objectweb.proactive.ActiveObjectCreationException)1 ProActiveException (org.objectweb.proactive.core.ProActiveException)1 NodeException (org.objectweb.proactive.core.node.NodeException)1 Client (org.ow2.proactive.resourcemanager.authentication.Client)1 RMCore (org.ow2.proactive.resourcemanager.core.RMCore)1 AddingNodesException (org.ow2.proactive.resourcemanager.exception.AddingNodesException)1 NotConnectedException (org.ow2.proactive.resourcemanager.exception.NotConnectedException)1 RMException (org.ow2.proactive.resourcemanager.exception.RMException)1 RMMonitoringImpl (org.ow2.proactive.resourcemanager.frontend.RMMonitoringImpl)1