Search in sources :

Example 16 with RegistryException

use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.

the class ExperimentRegistry method addTaskError.

public String addTaskError(ErrorModel taskError, String taskId) throws RegistryException {
    try {
        TaskErrorResource error = new TaskErrorResource();
        error.setTaskId(taskId);
        if (taskError.getErrorId() == null) {
            error.setErrorId(AiravataUtils.getId("TASK_ERROR"));
        } else {
            error.setErrorId(taskError.getErrorId());
        }
        error.setCreationTime(AiravataUtils.getTime(taskError.getCreationTime()));
        error.setActualErrorMessage(taskError.getActualErrorMessage());
        error.setUserFriendlyMessage(taskError.getUserFriendlyMessage());
        error.setTransientOrPersistent(taskError.isTransientOrPersistent());
        if (taskError.getRootCauseErrorIdList() != null) {
            error.setRootCauseErrorIdList(StringUtils.join(taskError.getRootCauseErrorIdList(), ","));
        }
        error.save();
    } catch (Exception e) {
        logger.error(taskId, "Error while adding task status...", e);
        throw new RegistryException(e);
    }
    return taskId;
}
Also used : RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 17 with RegistryException

use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.

the class ExperimentRegistry method getExperimentStatistics.

public ExperimentStatistics getExperimentStatistics(Map<String, String> filters) throws RegistryException {
    try {
        ExperimentStatistics experimentStatistics = new ExperimentStatistics();
        ExperimentStatisticsResource experimentStatisticsResource = workerResource.getExperimentStatistics(filters.get(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID), new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.FROM_DATE))), new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.TO_DATE))), filters.get(Constants.FieldConstants.ExperimentConstants.USER_NAME), filters.get(Constants.FieldConstants.ExperimentConstants.EXECUTION_ID), filters.get(Constants.FieldConstants.ExperimentConstants.RESOURCE_HOST_ID));
        experimentStatistics.setAllExperimentCount(experimentStatisticsResource.getAllExperimentCount());
        experimentStatistics.setCreatedExperimentCount(experimentStatisticsResource.getCreatedExperimentCount());
        experimentStatistics.setRunningExperimentCount(experimentStatisticsResource.getRunningExperimentCount());
        experimentStatistics.setCompletedExperimentCount(experimentStatisticsResource.getCompletedExperimentCount());
        experimentStatistics.setFailedExperimentCount(experimentStatisticsResource.getFailedExperimentCount());
        experimentStatistics.setCancelledExperimentCount(experimentStatisticsResource.getCancelledExperimentCount());
        ArrayList<ExperimentSummaryModel> experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getAllExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setAllExperiments(experimentSummaries);
        experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getCreatedExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setCreatedExperiments(experimentSummaries);
        experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getRunningExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setRunningExperiments(experimentSummaries);
        experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getCompletedExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setCompletedExperiments(experimentSummaries);
        experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getFailedExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setFailedExperiments(experimentSummaries);
        experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getCancelledExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setCancelledExperiments(experimentSummaries);
        return experimentStatistics;
    } catch (RegistryException e) {
        logger.error("Error while retrieving experiment statistics from registry", e);
        throw new RegistryException(e);
    }
}
Also used : ExperimentSummaryModel(org.apache.airavata.model.experiment.ExperimentSummaryModel) ExperimentStatistics(org.apache.airavata.model.experiment.ExperimentStatistics) Timestamp(java.sql.Timestamp) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 18 with RegistryException

use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.

the class ExperimentRegistry method updateUserConfigDataField.

public void updateUserConfigDataField(String expID, String fieldName, Object value) throws RegistryException {
    try {
        ExperimentResource experiment = new ExperimentResource();
        experiment.setExperimentId(expID);
        UserConfigurationDataResource exConfigData = (UserConfigurationDataResource) experiment.get(ResourceType.USER_CONFIGURATION_DATA, expID);
        if (fieldName.equals(Constants.FieldConstants.UserConfigurationDataConstants.AIRAVATA_AUTO_SCHEDULE)) {
            exConfigData.setAiravataAutoSchedule((Boolean) value);
            exConfigData.save();
        } else if (fieldName.equals(Constants.FieldConstants.UserConfigurationDataConstants.OVERRIDE_MANUAL_PARAMS)) {
            exConfigData.setOverrideManualScheduledParams((Boolean) value);
            exConfigData.save();
        } else if (fieldName.equals(Constants.FieldConstants.UserConfigurationDataConstants.SHARE_EXP)) {
            exConfigData.setShareExperimentPublically((Boolean) value);
            exConfigData.save();
        } else if (fieldName.equals(Constants.FieldConstants.UserConfigurationDataConstants.COMPUTATIONAL_RESOURCE_SCHEDULING)) {
            updateComputeResourceScheduling((ComputationalResourceSchedulingModel) value, expID);
        } else {
            logger.error("Unsupported field type for Experiment config data");
        }
    } catch (Exception e) {
        logger.error("Error while updating fields in experiment config...", e);
        throw new RegistryException(e);
    }
}
Also used : ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel) RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 19 with RegistryException

use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.

the class ExperimentRegistry method addProcessInputs.

public String addProcessInputs(List<InputDataObjectType> processInputs, String processID) throws RegistryException {
    try {
        for (InputDataObjectType input : processInputs) {
            ProcessInputResource resource = new ProcessInputResource();
            resource.setProcessId(processID);
            resource.setInputName(input.getName());
            resource.setInputValue(input.getValue());
            if (input.getType() != null) {
                resource.setDataType(input.getType().toString());
            }
            resource.setMetadata(input.getMetaData());
            resource.setApplicationArgument(input.getApplicationArgument());
            resource.setInputOrder(input.getInputOrder());
            resource.setIsRequired(input.isIsRequired());
            resource.setRequiredToAddedToCmd(input.isRequiredToAddedToCommandLine());
            resource.setStorageResourceId(input.getStorageResourceId());
            resource.setIsReadOnly(input.isIsReadOnly());
            resource.save();
        }
        return processID;
    } catch (Exception e) {
        logger.error("Unable to save process inputs", e);
        throw new RegistryException(e);
    }
}
Also used : InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 20 with RegistryException

use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.

the class ExperimentRegistry method getExperimentIDs.

// CPI getIds method
public List<String> getExperimentIDs(String fieldName, Object value) throws RegistryException {
    List<String> expIDs = new ArrayList<String>();
    try {
        if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID)) {
            if (gatewayResource == null) {
                logger.error("You should use an existing gateway in order to retrieve experiments..");
                return null;
            } else {
                List<ExperimentResource> resources = gatewayResource.getExperiments();
                for (ExperimentResource resource : resources) {
                    String expID = resource.getExperimentId();
                    expIDs.add(expID);
                }
            }
        } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.USER_NAME)) {
            List<ExperimentResource> resources = workerResource.getExperiments();
            for (ExperimentResource resource : resources) {
                expIDs.add(resource.getExperimentId());
            }
        } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.PROJECT_ID)) {
            List<ExperimentResource> resources = workerResource.getExperiments();
            for (ExperimentResource resource : resources) {
                expIDs.add(resource.getExperimentId());
            }
        }
    } catch (Exception e) {
        logger.error("Error while retrieving experiment ids..", e);
        throw new RegistryException(e);
    }
    return expIDs;
}
Also used : RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Aggregations

RegistryException (org.apache.airavata.registry.cpi.RegistryException)134 EntityManager (javax.persistence.EntityManager)54 Query (javax.persistence.Query)29 QueryGenerator (org.apache.airavata.registry.core.experiment.catalog.utils.QueryGenerator)29 ArrayList (java.util.ArrayList)15 List (java.util.List)12 ExperimentCatResource (org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource)12 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)11 ExperimentCatalogException (org.apache.airavata.registry.cpi.ExperimentCatalogException)8 AiravataException (org.apache.airavata.common.exception.AiravataException)6 GFacException (org.apache.airavata.gfac.core.GFacException)6 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)6 Node (org.apache.airavata.workflow.model.graph.Node)6 DynamicNode (org.apache.airavata.workflow.model.graph.dynamic.DynamicNode)6 SubWorkflowNode (org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode)6 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)6 Timestamp (java.sql.Timestamp)5 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)4 DataPort (org.apache.airavata.workflow.model.graph.DataPort)4 HashMap (java.util.HashMap)3