Search in sources :

Example 16 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class ExperimentRegistry method addExpOutputs.

public String addExpOutputs(List<OutputDataObjectType> exOutput, String expId) throws RegistryException {
    try {
        for (OutputDataObjectType output : exOutput) {
            ExperimentOutputResource resource = new ExperimentOutputResource();
            resource.setExperimentId(expId);
            resource.setOutputName(output.getName());
            resource.setOutputValue(output.getValue());
            if (output.getType() != null) {
                resource.setDataType(output.getType().toString());
            }
            resource.setApplicationArgument(output.getApplicationArgument());
            resource.setIsRequired(output.isIsRequired());
            resource.setRequiredToAddedToCmd(output.isRequiredToAddedToCommandLine());
            resource.setDataMovement(output.isDataMovement());
            resource.setLocation(output.getLocation());
            resource.setSearchQuery(output.getSearchQuery());
            resource.setOutputStreaming(output.isOutputStreaming());
            resource.setStorageResourceId(output.getStorageResourceId());
            resource.save();
        }
    } catch (Exception e) {
        logger.error("Error while adding experiment outputs...", e);
        throw new RegistryException(e);
    }
    return expId;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 17 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class AppCatalogThriftConversion method getOutputDataObjType.

public static OutputDataObjectType getOutputDataObjType(ApplicationOutputResource output) {
    OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
    outputDataObjectType.setName(output.getOutputKey());
    outputDataObjectType.setValue(output.getOutputVal());
    outputDataObjectType.setType(DataType.valueOf(output.getDataType()));
    outputDataObjectType.setIsRequired(output.getRequired());
    outputDataObjectType.setRequiredToAddedToCommandLine(output.getRequiredToCMD());
    outputDataObjectType.setDataMovement(output.isDataMovement());
    outputDataObjectType.setLocation(output.getDataNameLocation());
    outputDataObjectType.setSearchQuery(output.getSearchQuery());
    outputDataObjectType.setApplicationArgument(output.getAppArgument());
    outputDataObjectType.setOutputStreaming(output.isOutputStreaming());
    return outputDataObjectType;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType)

Example 18 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class WorkflowCatalogImpl method updateWorkflow.

@Override
public void updateWorkflow(String workflowTemplateId, WorkflowModel workflow) throws WorkflowCatalogException {
    try {
        WorkflowResource resource = new WorkflowResource();
        WorkflowResource existingWF = (WorkflowResource) resource.get(workflowTemplateId);
        existingWF.setWfName(workflow.getName());
        existingWF.setGraph(workflow.getGraph());
        if (workflow.getImage() != null) {
            existingWF.setImage(new String(workflow.getImage()));
        }
        existingWF.save();
        List<InputDataObjectType> existingwFInputs = workflow.getWorkflowInputs();
        if (existingwFInputs != null && existingwFInputs.size() != 0) {
            for (InputDataObjectType input : existingwFInputs) {
                WorkflowInputResource wfInputResource = new WorkflowInputResource();
                Map<String, String> ids = new HashMap<String, String>();
                ids.put(WorkflowCatAbstractResource.WorkflowInputConstants.WF_TEMPLATE_ID, existingWF.getWfTemplateId());
                ids.put(WorkflowCatAbstractResource.WorkflowInputConstants.INPUT_KEY, input.getName());
                WorkflowInputResource existingInput = (WorkflowInputResource) wfInputResource.get(ids);
                existingInput.setWorkflowResource(existingWF);
                existingInput.setInputKey(input.getName());
                existingInput.setInputVal(input.getValue());
                existingInput.setWfTemplateId(existingWF.getWfTemplateId());
                existingInput.setDataType(input.getType().toString());
                existingInput.setAppArgument(input.getApplicationArgument());
                existingInput.setStandardInput(input.isStandardInput());
                existingInput.setUserFriendlyDesc(input.getUserFriendlyDescription());
                existingInput.setMetadata(input.getMetaData());
                existingInput.save();
            }
        }
        List<OutputDataObjectType> workflowOutputs = workflow.getWorkflowOutputs();
        if (workflowOutputs != null && workflowOutputs.size() != 0) {
            for (OutputDataObjectType output : workflowOutputs) {
                WorkflowOutputResource outputResource = new WorkflowOutputResource();
                Map<String, String> ids = new HashMap<String, String>();
                ids.put(WorkflowCatAbstractResource.WorkflowOutputConstants.WF_TEMPLATE_ID, existingWF.getWfTemplateId());
                ids.put(WorkflowCatAbstractResource.WorkflowOutputConstants.OUTPUT_KEY, output.getName());
                WorkflowOutputResource existingOutput = (WorkflowOutputResource) outputResource.get(ids);
                existingOutput.setWorkflowResource(existingWF);
                existingOutput.setOutputKey(output.getName());
                existingOutput.setOutputVal(output.getValue());
                existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
                existingOutput.setDataType(output.getType().toString());
                existingOutput.setDataType(output.getType().toString());
                existingOutput.setAppArgument(output.getApplicationArgument());
                existingOutput.setDataNameLocation(output.getLocation());
                existingOutput.setRequired(output.isIsRequired());
                existingOutput.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
                existingOutput.setOutputStreaming(output.isOutputStreaming());
                existingOutput.setDataMovement(output.isDataMovement());
                existingOutput.save();
            }
        }
    } catch (Exception e) {
        logger.error("Error while updating the workflow...", e);
        throw new WorkflowCatalogException(e);
    }
}
Also used : WorkflowCatalogException(org.apache.airavata.registry.cpi.WorkflowCatalogException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) HashMap(java.util.HashMap) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) WorkflowCatalogException(org.apache.airavata.registry.cpi.WorkflowCatalogException)

Example 19 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class WorkflowCatalogImpl method registerWorkflow.

@Override
public String registerWorkflow(WorkflowModel workflow, String gatewayId) throws WorkflowCatalogException {
    try {
        WorkflowResource resource = new WorkflowResource();
        resource.setWfTemplateId(WorkflowCatalogUtils.getID(workflow.getName()));
        resource.setWfName(workflow.getName());
        resource.setGraph(workflow.getGraph());
        resource.setGatewayId(gatewayId);
        if (workflow.getImage() != null) {
            resource.setImage(new String(workflow.getImage()));
        }
        resource.save();
        workflow.setTemplateId(resource.getWfTemplateId());
        List<InputDataObjectType> workflowInputs = workflow.getWorkflowInputs();
        if (workflowInputs != null && workflowInputs.size() != 0) {
            for (InputDataObjectType input : workflowInputs) {
                WorkflowInputResource wfInputResource = new WorkflowInputResource();
                wfInputResource.setWorkflowResource(resource);
                wfInputResource.setInputKey(input.getName());
                wfInputResource.setInputVal(input.getValue());
                wfInputResource.setWfTemplateId(resource.getWfTemplateId());
                wfInputResource.setDataType(input.getType().toString());
                wfInputResource.setAppArgument(input.getApplicationArgument());
                wfInputResource.setStandardInput(input.isStandardInput());
                wfInputResource.setUserFriendlyDesc(input.getUserFriendlyDescription());
                wfInputResource.setMetadata(input.getMetaData());
                wfInputResource.save();
            }
        }
        List<OutputDataObjectType> workflowOutputs = workflow.getWorkflowOutputs();
        if (workflowOutputs != null && workflowOutputs.size() != 0) {
            for (OutputDataObjectType output : workflowOutputs) {
                WorkflowOutputResource outputResource = new WorkflowOutputResource();
                outputResource.setWorkflowResource(resource);
                outputResource.setOutputKey(output.getName());
                outputResource.setOutputVal(output.getValue());
                outputResource.setWfTemplateId(resource.getWfTemplateId());
                outputResource.setDataType(output.getType().toString());
                outputResource.setAppArgument(output.getApplicationArgument());
                outputResource.setDataNameLocation(output.getLocation());
                outputResource.setRequired(output.isIsRequired());
                outputResource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
                outputResource.setOutputStreaming(output.isOutputStreaming());
                outputResource.setDataMovement(output.isDataMovement());
                outputResource.save();
            }
        }
        return resource.getWfTemplateId();
    } catch (Exception e) {
        logger.error("Error while saving the workflow...", e);
        throw new WorkflowCatalogException(e);
    }
}
Also used : WorkflowCatalogException(org.apache.airavata.registry.cpi.WorkflowCatalogException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) WorkflowCatalogException(org.apache.airavata.registry.cpi.WorkflowCatalogException)

Example 20 with OutputDataObjectType

use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.

the class WorkflowCatalogImpl method updateWorkflowOutputs.

@Override
public void updateWorkflowOutputs(String workflowTemplateId, List<OutputDataObjectType> workflowOutputs) throws WorkflowCatalogException {
    WorkflowResource resource = new WorkflowResource();
    WorkflowResource existingWF = (WorkflowResource) resource.get(workflowTemplateId);
    if (workflowOutputs != null && workflowOutputs.size() != 0) {
        for (OutputDataObjectType output : workflowOutputs) {
            WorkflowOutputResource outputResource = new WorkflowOutputResource();
            Map<String, String> ids = new HashMap<String, String>();
            ids.put(WorkflowCatAbstractResource.WorkflowOutputConstants.WF_TEMPLATE_ID, existingWF.getWfTemplateId());
            ids.put(WorkflowCatAbstractResource.WorkflowOutputConstants.OUTPUT_KEY, output.getName());
            WorkflowOutputResource existingOutput = (WorkflowOutputResource) outputResource.get(ids);
            existingOutput.setWorkflowResource(existingWF);
            existingOutput.setOutputKey(output.getName());
            existingOutput.setOutputVal(output.getValue());
            existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
            existingOutput.setDataType(output.getType().toString());
            existingOutput.setDataType(output.getType().toString());
            existingOutput.setAppArgument(output.getApplicationArgument());
            existingOutput.setDataNameLocation(output.getLocation());
            existingOutput.setRequired(output.isIsRequired());
            existingOutput.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
            existingOutput.setOutputStreaming(output.isOutputStreaming());
            existingOutput.setDataMovement(output.isDataMovement());
            existingOutput.save();
        }
    }
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) HashMap(java.util.HashMap)

Aggregations

OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)93 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)60 TException (org.apache.thrift.TException)51 AuthzToken (org.apache.airavata.model.security.AuthzToken)44 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)34 ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)33 UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)33 ArrayList (java.util.ArrayList)18 Project (org.apache.airavata.model.workspace.Project)16 RegistryException (org.apache.airavata.registry.cpi.RegistryException)14 GFacException (org.apache.airavata.gfac.core.GFacException)7 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)7 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)7 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)7 URISyntaxException (java.net.URISyntaxException)6 AiravataException (org.apache.airavata.common.exception.AiravataException)5 HashMap (java.util.HashMap)4 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)4 ProcessContext (org.apache.airavata.gfac.core.context.ProcessContext)4 JobStatus (org.apache.airavata.model.status.JobStatus)4