Search in sources :

Example 1 with WorkflowParser

use of org.apache.airavata.workflow.core.parser.WorkflowParser in project airavata by apache.

the class WorkflowFactory method getWorkflowParser.

public static WorkflowParser getWorkflowParser(String workflowString) throws Exception {
    WorkflowParser workflowParser = null;
    try {
        String wfParserClassName = ServerSettings.getWorkflowParser();
        Class<?> aClass = Class.forName(wfParserClassName);
        Constructor<?> constructor = aClass.getConstructor(String.class);
        workflowParser = (WorkflowParser) constructor.newInstance(workflowString);
    } catch (ApplicationSettingsException e) {
        log.info("A custom workflow parser is not defined, Use default Airavata JSON workflow parser");
    }
    if (workflowParser == null) {
        workflowParser = new JsonWorkflowParser(workflowString);
    }
    return workflowParser;
}
Also used : ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) JsonWorkflowParser(org.apache.airavata.workflow.core.parser.JsonWorkflowParser) WorkflowParser(org.apache.airavata.workflow.core.parser.WorkflowParser) JsonWorkflowParser(org.apache.airavata.workflow.core.parser.JsonWorkflowParser)

Example 2 with WorkflowParser

use of org.apache.airavata.workflow.core.parser.WorkflowParser 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)

Aggregations

WorkflowParser (org.apache.airavata.workflow.core.parser.WorkflowParser)2 AiravataException (org.apache.airavata.common.exception.AiravataException)1 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)1 InputNode (org.apache.airavata.workflow.core.dag.nodes.InputNode)1 JsonWorkflowParser (org.apache.airavata.workflow.core.parser.JsonWorkflowParser)1