Search in sources :

Example 46 with OutputDataObjectType

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

the class ExperimentRegistry method updateProcessOutputs.

public void updateProcessOutputs(List<OutputDataObjectType> processOutput, String processID) throws RegistryException {
    try {
        ProcessResource processResource = new ProcessResource();
        processResource.setProcessId(processID);
        List<ProcessOutputResource> existingProcessOutputs = processResource.getProcessOutputs();
        for (OutputDataObjectType output : processOutput) {
            for (ProcessOutputResource resource : existingProcessOutputs) {
                if (resource.getOutputName().equals(output.getName())) {
                    resource.setProcessId(processID);
                    resource.setOutputName(output.getName());
                    resource.setOutputValue(output.getValue());
                    if (output.getType() != null) {
                        resource.setDataType(output.getType().toString());
                    }
                    resource.setIsRequired(output.isIsRequired());
                    resource.setRequiredToAddedToCmd(output.isRequiredToAddedToCommandLine());
                    resource.setDataMovement(output.isDataMovement());
                    resource.setLocation(output.getLocation());
                    resource.setApplicationArgument(output.getApplicationArgument());
                    resource.setSearchQuery(output.getSearchQuery());
                    resource.setOutputStreaming(output.isOutputStreaming());
                    resource.setStorageResourceId(output.getStorageResourceId());
                    resource.save();
                }
            }
        }
    } catch (Exception e) {
        logger.error("Error while updating process outputs", e);
        throw new RegistryException(e);
    }
}
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 47 with OutputDataObjectType

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

the class ExperimentRegistry method updateExperiment.

// CPI Update Methods
public void updateExperiment(ExperimentModel experiment, String expId) throws RegistryException {
    try {
        if (!workerResource.isProjectExists(experiment.getProjectId())) {
            logger.error("Project does not exist in the system..");
            throw new Exception("Project does not exist in the system, Please create the project first...");
        }
        ExperimentResource existingExperiment = gatewayResource.getExperiment(expId);
        existingExperiment.setExperimentName(experiment.getExperimentName());
        existingExperiment.setUserName(experiment.getUserName());
        existingExperiment.setGatewayId(experiment.getGatewayId());
        existingExperiment.setGatewayExecutionId(experiment.getGatewayExecutionId());
        existingExperiment.setGatewayInstanceId(experiment.getGatewayInstanceId());
        existingExperiment.setProjectId(experiment.getProjectId());
        existingExperiment.setCreationTime(AiravataUtils.getTime(experiment.getCreationTime()));
        existingExperiment.setDescription(experiment.getDescription());
        existingExperiment.setExecutionId(experiment.getExecutionId());
        if (experiment.isEnableEmailNotification()) {
            existingExperiment.setEnableEmailNotification(true);
            if (experiment.getEmailAddresses() != null) {
                existingExperiment.setEmailAddresses(StringUtils.join(experiment.getEmailAddresses(), ","));
            }
        } else {
            existingExperiment.setEnableEmailNotification(false);
        }
        existingExperiment.save();
        UserConfigurationDataModel userConfigurationData = experiment.getUserConfigurationData();
        if (userConfigurationData != null) {
            updateUserConfigData(userConfigurationData, expId);
        }
        List<InputDataObjectType> experimentInputs = experiment.getExperimentInputs();
        if (experimentInputs != null && !experimentInputs.isEmpty()) {
            updateExpInputs(experimentInputs, expId);
        }
        List<OutputDataObjectType> experimentOutputs = experiment.getExperimentOutputs();
        if (experimentOutputs != null && !experimentOutputs.isEmpty()) {
            updateExpOutputs(experimentOutputs, expId);
        }
        List<ExperimentStatus> experimentStatuses = experiment.getExperimentStatus();
        if (experimentStatuses != null && experimentStatuses.size() > 0) {
            if (experimentStatuses.get(0) != null) {
                updateExperimentStatus(experimentStatuses.get(0), expId);
            }
        }
        List<ErrorModel> errors = experiment.getErrors();
        if (errors != null && !errors.isEmpty()) {
            for (ErrorModel errror : errors) {
                updateExperimentError(errror, expId);
            }
        }
    } catch (Exception e) {
        logger.error("Error while updating experiment...", e);
        throw new RegistryException(e);
    }
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ErrorModel(org.apache.airavata.model.commons.ErrorModel) RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 48 with OutputDataObjectType

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

the class ThriftDataModelConversion method getProcessOutputs.

public static List<OutputDataObjectType> getProcessOutputs(List<ProcessOutputResource> processOutputResources) {
    List<OutputDataObjectType> processOutputs = new ArrayList<OutputDataObjectType>();
    if (processOutputResources != null && !processOutputResources.isEmpty()) {
        for (ProcessOutputResource outputResource : processOutputResources) {
            OutputDataObjectType output = getOutput(outputResource);
            processOutputs.add(output);
        }
    }
    return processOutputs;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) ArrayList(java.util.ArrayList)

Example 49 with OutputDataObjectType

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

the class ThriftDataModelConversion method getExpOutputs.

public static List<OutputDataObjectType> getExpOutputs(List<ExperimentOutputResource> experimentOutputResourceList) {
    List<OutputDataObjectType> exOutputs = new ArrayList<OutputDataObjectType>();
    if (experimentOutputResourceList != null && !experimentOutputResourceList.isEmpty()) {
        for (ExperimentOutputResource outputResource : experimentOutputResourceList) {
            OutputDataObjectType output = getOutput(outputResource);
            exOutputs.add(output);
        }
    }
    return exOutputs;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) ArrayList(java.util.ArrayList)

Example 50 with OutputDataObjectType

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

the class ThriftDataModelConversion method getOutput.

public static OutputDataObjectType getOutput(Object object) {
    if (object != null) {
        OutputDataObjectType dataObjectType = new OutputDataObjectType();
        if (object instanceof ExperimentOutputResource) {
            ExperimentOutputResource outputResource = (ExperimentOutputResource) object;
            dataObjectType.setName(outputResource.getOutputName());
            dataObjectType.setValue(outputResource.getOutputValue());
            dataObjectType.setType(DataType.valueOf(outputResource.getDataType()));
            dataObjectType.setApplicationArgument(outputResource.getApplicationArgument());
            dataObjectType.setIsRequired(outputResource.getIsRequired());
            dataObjectType.setRequiredToAddedToCommandLine(outputResource.getRequiredToAddedToCmd());
            dataObjectType.setDataMovement(outputResource.getDataMovement());
            dataObjectType.setLocation(outputResource.getLocation());
            dataObjectType.setSearchQuery(outputResource.getSearchQuery());
            dataObjectType.setOutputStreaming(outputResource.isOutputStreaming());
            dataObjectType.setStorageResourceId(outputResource.getStorageResourceId());
            return dataObjectType;
        } else if (object instanceof ProcessOutputResource) {
            ProcessOutputResource outputResource = (ProcessOutputResource) object;
            dataObjectType.setName(outputResource.getOutputName());
            dataObjectType.setValue(outputResource.getOutputValue());
            dataObjectType.setType(DataType.valueOf(outputResource.getDataType()));
            dataObjectType.setApplicationArgument(outputResource.getApplicationArgument());
            dataObjectType.setIsRequired(outputResource.getIsRequired());
            dataObjectType.setRequiredToAddedToCommandLine(outputResource.getRequiredToAddedToCmd());
            dataObjectType.setDataMovement(outputResource.getDataMovement());
            dataObjectType.setLocation(outputResource.getLocation());
            dataObjectType.setSearchQuery(outputResource.getSearchQuery());
            dataObjectType.setOutputStreaming(outputResource.isOutputStreaming());
            dataObjectType.setStorageResourceId(outputResource.getStorageResourceId());
            return dataObjectType;
        } else {
            return null;
        }
    }
    return null;
}
Also used : OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType)

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