Search in sources :

Example 1 with NotConfiguredException

use of org.objectweb.proactive.extensions.dataspaces.exceptions.NotConfiguredException in project scheduling by ow2-proactive.

the class RMNodeConfigurator method configureNode.

/**
 * Configures the node.
 * Every different configuration steps must be handled in this method.
 * @param rmnodeToAdd the rmnode to be configured
 */
public void configureNode(RMNode rmnodeToAdd) {
    String nodeURL = rmnodeToAdd.getNodeURL();
    try {
        Node nodeToAdd = rmnodeToAdd.getNode();
        String dataSpaceStatus = nodeToAdd.getProperty(RMNodeStarter.DATASPACES_STATUS_PROP_NAME);
        if (dataSpaceStatus == null) {
            // no data space configured on the node
            logger.debug("Configuring data spaces for node " + nodeToAdd.getNodeInformation().getURL());
            if (!configureForDataSpace(nodeToAdd)) {
                // the dataspaces could not be configured, the node should be killed.
                nodeToAdd.getProActiveRuntime().killRT(true);
                throw new NotConfiguredException("Failed to configure dataspaces, check the node logs for more details");
            }
        } else if (!dataSpaceStatus.equals(Boolean.TRUE.toString())) {
            // there was a problem of data space configuring
            nodeToAdd.getProActiveRuntime().killRT(true);
            throw new NotConfiguredException("Cannot configure data spaces : " + dataSpaceStatus);
        } else {
            // data space is configured
            logger.debug("Data spaces is already configured for node " + nodeToAdd.getNodeInformation().getURL());
        }
        // get the node tags specified in the node property NODE_TAGS_PROP_NAME (separated by comma)
        String tagsString = nodeToAdd.getProperty(RMNodeStarter.NODE_TAGS_PROP_NAME);
        if (tagsString != null && !tagsString.isEmpty()) {
            Set<String> tags = Arrays.stream(tagsString.split(",")).map(String::trim).filter(s -> !s.isEmpty()).collect(Collectors.toSet());
            rmnodeToAdd.setNodeTags(tags);
        }
        // setting node JMX connector urls
        rmnodeToAdd.setJMXUrl(JMXTransportProtocol.RMI, nodeToAdd.getProperty(RMNodeStarter.JMX_URL + JMXTransportProtocol.RMI));
        rmnodeToAdd.setJMXUrl(JMXTransportProtocol.RO, nodeToAdd.getProperty(RMNodeStarter.JMX_URL + JMXTransportProtocol.RO));
        // blocking call involving running ping process on the node
        if (PAResourceManagerProperties.RM_TOPOLOGY_ENABLED.getValueAsBoolean()) {
            RMCore.topologyManager.addNode(nodeToAdd);
        }
        rmcore.internalAddNodeToCore(rmnodeToAdd);
    } catch (Exception e) {
        logger.error("Cannot properly configure the node " + nodeURL + " because of an error during configuration phase", e);
        // if a problem occurs during the configuration step,
        // the node is set to down
        rmcore.setDownNode(nodeURL);
    }
}
Also used : Arrays(java.util.Arrays) ActiveObjectCreationException(org.objectweb.proactive.ActiveObjectCreationException) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Predicate(java.util.function.Predicate) Request(org.objectweb.proactive.core.body.request.Request) NotConfiguredException(org.objectweb.proactive.extensions.dataspaces.exceptions.NotConfiguredException) Set(java.util.Set) Service(org.objectweb.proactive.Service) Node(org.objectweb.proactive.core.node.Node) Collectors(java.util.stream.Collectors) RMNodeStarter(org.ow2.proactive.resourcemanager.utils.RMNodeStarter) PAResourceManagerProperties(org.ow2.proactive.resourcemanager.core.properties.PAResourceManagerProperties) Logger(org.apache.log4j.Logger) RMCore(org.ow2.proactive.resourcemanager.core.RMCore) Body(org.objectweb.proactive.Body) NodeException(org.objectweb.proactive.core.node.NodeException) ActiveObject(org.objectweb.proactive.extensions.annotation.ActiveObject) JMXTransportProtocol(org.ow2.proactive.jmx.naming.JMXTransportProtocol) RunActive(org.objectweb.proactive.RunActive) NotConfiguredException(org.objectweb.proactive.extensions.dataspaces.exceptions.NotConfiguredException) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Node(org.objectweb.proactive.core.node.Node) ActiveObjectCreationException(org.objectweb.proactive.ActiveObjectCreationException) NotConfiguredException(org.objectweb.proactive.extensions.dataspaces.exceptions.NotConfiguredException) NodeException(org.objectweb.proactive.core.node.NodeException)

Aggregations

Arrays (java.util.Arrays)1 Set (java.util.Set)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 Logger (org.apache.log4j.Logger)1 ActiveObjectCreationException (org.objectweb.proactive.ActiveObjectCreationException)1 Body (org.objectweb.proactive.Body)1 RunActive (org.objectweb.proactive.RunActive)1 Service (org.objectweb.proactive.Service)1 Request (org.objectweb.proactive.core.body.request.Request)1 Node (org.objectweb.proactive.core.node.Node)1 NodeException (org.objectweb.proactive.core.node.NodeException)1 ActiveObject (org.objectweb.proactive.extensions.annotation.ActiveObject)1 NotConfiguredException (org.objectweb.proactive.extensions.dataspaces.exceptions.NotConfiguredException)1 JMXTransportProtocol (org.ow2.proactive.jmx.naming.JMXTransportProtocol)1 RMCore (org.ow2.proactive.resourcemanager.core.RMCore)1 PAResourceManagerProperties (org.ow2.proactive.resourcemanager.core.properties.PAResourceManagerProperties)1 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)1 RMNodeStarter (org.ow2.proactive.resourcemanager.utils.RMNodeStarter)1