Search in sources :

Example 11 with RegistryException

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

the class ExperimentRegistry method updateProcessResourceSchedule.

public String updateProcessResourceSchedule(ComputationalResourceSchedulingModel resourceSchedule, String processID) throws RegistryException {
    try {
        ProcessResource processResource = new ProcessResource();
        processResource.setProcessId(processID);
        ProcessResourceScheduleResource processResourceSchedule = processResource.getProcessResourceSchedule();
        processResourceSchedule.setProcessId(processID);
        processResourceSchedule.setResourceHostId(resourceSchedule.getResourceHostId());
        processResourceSchedule.setTotalCpuCount(resourceSchedule.getTotalCPUCount());
        processResourceSchedule.setNodeCount(resourceSchedule.getNodeCount());
        processResourceSchedule.setNumberOfThreads(resourceSchedule.getNumberOfThreads());
        processResourceSchedule.setQueueName(resourceSchedule.getQueueName());
        processResourceSchedule.setWallTimeLimit(resourceSchedule.getWallTimeLimit());
        processResourceSchedule.setTotalPhysicalMemory(resourceSchedule.getTotalPhysicalMemory());
        processResourceSchedule.setOverrideAllocationProjectNumber(resourceSchedule.getOverrideAllocationProjectNumber());
        processResourceSchedule.setOverrideLoginUserName(resourceSchedule.getOverrideLoginUserName());
        processResourceSchedule.setOverrideScratchLocation(resourceSchedule.getOverrideScratchLocation());
        processResourceSchedule.setStaticWorkingDir(resourceSchedule.getStaticWorkingDir());
        processResourceSchedule.save();
    } catch (Exception e) {
        logger.error("Unable to save process resource schedule data", e);
        throw new RegistryException(e);
    }
    return processID;
}
Also used : RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 12 with RegistryException

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

the class ExperimentRegistry method updateExpInputs.

public void updateExpInputs(List<InputDataObjectType> exInputs, String expID) throws RegistryException {
    try {
        ExperimentResource experimentResource = new ExperimentResource();
        experimentResource.setExperimentId(expID);
        List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
        for (InputDataObjectType input : exInputs) {
            for (ExperimentInputResource exinput : experimentInputs) {
                if (exinput.getInputName().equals(input.getName())) {
                    exinput.setInputValue(input.getValue());
                    exinput.setExperimentId(expID);
                    if (input.getType() != null) {
                        exinput.setDataType(input.getType().toString());
                    }
                    exinput.setMetadata(input.getMetaData());
                    exinput.setApplicationArgument(input.getApplicationArgument());
                    exinput.setInputOrder(input.getInputOrder());
                    exinput.setIsRequired(input.isIsRequired());
                    exinput.setRequiredToAddedToCmd(input.isRequiredToAddedToCommandLine());
                    exinput.setStorageResourceId(input.getStorageResourceId());
                    exinput.setIsReadOnly(input.isIsReadOnly());
                    exinput.save();
                }
            }
        }
    } catch (Exception e) {
        logger.error("Unable to update experiment 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 13 with RegistryException

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

the class ExperimentRegistry method updateExperimentField.

public void updateExperimentField(String expID, String fieldName, Object value) throws RegistryException {
    try {
        ExperimentResource experiment = gatewayResource.getExperiment(expID);
        if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_NAME)) {
            experiment.setExperimentName((String) value);
            experiment.save();
        } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.USER_NAME)) {
            experiment.setUserName((String) value);
            experiment.save();
        } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.DESCRIPTION)) {
            experiment.setDescription((String) value);
            experiment.save();
        } else {
            logger.error("Unsupported field type for Experiment");
        }
    } catch (Exception e) {
        logger.error("Error while updating fields in experiment...", e);
        throw new RegistryException(e);
    }
}
Also used : RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 14 with RegistryException

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

the class ExperimentRegistry method getExperimentList.

public List<ExperimentModel> getExperimentList(String fieldName, Object value, int limit, int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
    List<ExperimentModel> experiments = new ArrayList<ExperimentModel>();
    try {
        if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.USER_NAME)) {
            WorkerResource resource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
            resource.setUser((String) value);
            List<ExperimentResource> resources = resource.getExperiments(limit, offset, orderByIdentifier, resultOrderType);
            for (ExperimentResource experimentResource : resources) {
                ExperimentModel experiment = ThriftDataModelConversion.getExperiment(experimentResource);
                experiments.add(experiment);
            }
            return experiments;
        } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.PROJECT_ID)) {
            ProjectResource project = workerResource.getProject((String) value);
            List<ExperimentResource> resources = project.getExperiments(limit, offset, Constants.FieldConstants.ExperimentConstants.CREATION_TIME, ResultOrderType.DESC);
            for (ExperimentResource resource : resources) {
                ExperimentModel experiment = ThriftDataModelConversion.getExperiment(resource);
                experiments.add(experiment);
            }
            return experiments;
        }
        logger.error("Unsupported field name to retrieve experiment list...");
    } catch (Exception e) {
        logger.error("Error while getting experiment list...", e);
        throw new RegistryException(e);
    }
    return experiments;
}
Also used : ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 15 with RegistryException

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

the class ExperimentRegistry method removeProcessResourceSchedule.

public void removeProcessResourceSchedule(String processId) throws RegistryException {
    try {
        ExperimentResource experiment = new ExperimentResource();
        experiment.remove(ResourceType.PROCESS_RESOURCE_SCHEDULE, processId);
    } catch (Exception e) {
        logger.error("Error while removing workflow node..", e);
        throw new RegistryException(e);
    }
}
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