Search in sources :

Example 31 with AiravataException

use of org.apache.airavata.common.exception.AiravataException in project airavata by apache.

the class Monitor method unsubscribe.

/**
 * Unsubcribe from the ws messager client
 * @throws MonitorException
 */
public void unsubscribe(String experimentId) {
    // Enable/disable some menu items.
    sendSafeEvent(new Event(Event.Type.MONITOR_STOPED));
    String id = expIdToSubscribers.remove(experimentId);
    if (id != null) {
        try {
            messageClient.stopListen(id);
        } catch (AiravataException e) {
            logger.warn("Failed to find the subscriber for experiment id: " + id, e);
        }
    }
    setMonitoring(false);
}
Also used : Event(org.apache.airavata.xbaya.messaging.event.Event) AiravataException(org.apache.airavata.common.exception.AiravataException)

Example 32 with AiravataException

use of org.apache.airavata.common.exception.AiravataException in project airavata by apache.

the class Monitor method start.

/**
 * @throws MonitorException
 */
public synchronized void start() throws MonitorException {
    // Make sure currently we are not doing any monitoring
    stop();
    // Reset monitoring variables
    monitoringCompleted = false;
    monitoringFailed = false;
    // Notify listeners that the monitoring is about to start
    getEventDataRepository().triggerListenerForPreMonitorStart();
    try {
        // AiravataUtils.setExecutionAsServer();
        this.messageClient = new RabbitMQStatusConsumer("amqp://localhost:5672", "airavata_rabbitmq_exchange");
    } catch (AiravataException e) {
        String msg = "Failed to start the consumer";
        logger.error(msg, e);
        throw new MonitorException(msg, e);
    }
    // Enable/disable some menu items and show the monitor panel.
    sendSafeEvent(new Event(Event.Type.MONITOR_STARTED));
    getEventDataRepository().triggerListenerForPostMonitorStart();
}
Also used : Event(org.apache.airavata.xbaya.messaging.event.Event) RabbitMQStatusConsumer(org.apache.airavata.messaging.core.impl.RabbitMQStatusConsumer) AiravataException(org.apache.airavata.common.exception.AiravataException)

Example 33 with AiravataException

use of org.apache.airavata.common.exception.AiravataException in project airavata by apache.

the class WorkflowInterpreter method launchWorkflow.

/**
 * Package-Private method.
 *
 * @throws Exception
 */
void launchWorkflow() throws Exception {
    // WorkflowBuilder workflowBuilder = WorkflowFactory.getWorkflowBuilder(experiment.getExperimentId(), credentialToken, null);
    workflowString = getWorkflow();
    WorkflowParser workflowParser = WorkflowFactory.getWorkflowParser(workflowString);
    log.debug("Initialized workflow parser");
    workflowParser.parse();
    setInputNodes(workflowParser.getInputNodes());
    log.debug("Parsed the workflow and got the workflow input nodes");
    // process workflow input nodes
    processWorkflowInputNodes(getInputNodes());
    if (readyList.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (InputNode inputNode : inputNodes) {
            sb.append(", ");
            sb.append(inputNode.getInputObject().getName());
            sb.append("=");
            sb.append(inputNode.getInputObject().getValue());
        }
        throw new AiravataException("No workflow application node is in ready state to run with experiment inputs" + sb.toString());
    }
    processReadyList();
}
Also used : InputNode(org.apache.airavata.workflow.core.dag.nodes.InputNode) WorkflowParser(org.apache.airavata.workflow.core.parser.WorkflowParser) AiravataException(org.apache.airavata.common.exception.AiravataException)

Example 34 with AiravataException

use of org.apache.airavata.common.exception.AiravataException in project airavata by apache.

the class WorkflowInterpreter method processReadyList.

// try to remove synchronization tag
/**
 * Package-Private method.
 *
 * @throws RegistryException
 * @throws AiravataException
 */
void processReadyList() throws RegistryException, AiravataException {
    if (readyList.isEmpty() && processingQueue.isEmpty() && !waitingList.isEmpty()) {
        throw new AiravataException("No workflow application node is in ready state to run");
    }
    for (WorkflowNode readyNode : readyList.values()) {
        if (readyNode instanceof OutputNode) {
            OutputNode outputNode = (OutputNode) readyNode;
            outputNode.getOutputObject().setValue(outputNode.getInPort().getInputObject().getValue());
            addToCompleteOutputNodeList(outputNode);
        } else if (readyNode instanceof InputNode) {
        // FIXME: set input object of applications and add applications to ready List.
        } else if (readyNode instanceof ApplicationNode) {
        // FIXME:  call orchestrator to create process for the application
        } else {
            throw new RuntimeException("Unsupported workflow node type");
        }
    }
    if (processingQueue.isEmpty() && waitingList.isEmpty()) {
        try {
            saveWorkflowOutputs();
        } catch (AppCatalogException e) {
            throw new AiravataException("Error while updating completed workflow outputs to registry", e);
        }
    }
}
Also used : InputNode(org.apache.airavata.workflow.core.dag.nodes.InputNode) OutputNode(org.apache.airavata.workflow.core.dag.nodes.OutputNode) AppCatalogException(org.apache.airavata.registry.cpi.AppCatalogException) ApplicationNode(org.apache.airavata.workflow.core.dag.nodes.ApplicationNode) WorkflowNode(org.apache.airavata.workflow.core.dag.nodes.WorkflowNode) AiravataException(org.apache.airavata.common.exception.AiravataException)

Example 35 with AiravataException

use of org.apache.airavata.common.exception.AiravataException in project airavata by apache.

the class XMLUtil method deepClone.

/**
 * @param element
 * @return The cloned XmlElement.
 */
public static org.xmlpull.infoset.XmlElement deepClone(org.xmlpull.infoset.XmlElement element) throws AiravataException {
    try {
        XmlElement clonedElement = element.clone();
        clonedElement.setParent(null);
        return clonedElement;
    } catch (CloneNotSupportedException e) {
        // This should not happen because we don't put any special Objects.
        throw new AiravataException(e.getMessage(), e);
    }
}
Also used : XmlElement(org.xmlpull.infoset.XmlElement) AiravataException(org.apache.airavata.common.exception.AiravataException)

Aggregations

AiravataException (org.apache.airavata.common.exception.AiravataException)40 IOException (java.io.IOException)10 TException (org.apache.thrift.TException)8 GFacException (org.apache.airavata.gfac.core.GFacException)6 RegistryException (org.apache.airavata.registry.cpi.RegistryException)6 XmlElement (org.xmlpull.infoset.XmlElement)5 ShutdownSignalException (com.rabbitmq.client.ShutdownSignalException)4 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)4 ProcessContext (org.apache.airavata.gfac.core.context.ProcessContext)4 MessagingException (javax.mail.MessagingException)3 MessageContext (org.apache.airavata.messaging.core.MessageContext)3 Session (com.jcraft.jsch.Session)2 ConnectionFactory (com.rabbitmq.client.ConnectionFactory)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 Flags (javax.mail.Flags)2 Message (javax.mail.Message)2 EmailParser (org.apache.airavata.gfac.core.monitor.EmailParser)2