Search in sources :

Example 71 with RegistryException

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

the class ExperimentRegistry method addProcess.

public String addProcess(ProcessModel process, String expId) throws RegistryException {
    try {
        ProcessResource processResource = new ProcessResource();
        String processId = AiravataUtils.getId("PROCESS");
        process.setProcessId(processId);
        processResource.setProcessId(processId);
        processResource.setExperimentId(expId);
        processResource.setCreationTime(AiravataUtils.getTime(process.getCreationTime()));
        processResource.setLastUpdateTime(AiravataUtils.getTime(process.getLastUpdateTime()));
        processResource.setProcessDetail(process.getProcessDetail());
        processResource.setApplicationInterfaceId(process.getApplicationInterfaceId());
        processResource.setTaskDag(process.getTaskDag());
        processResource.setGatewayExecutionId(process.getGatewayExecutionId());
        processResource.setComputeResourceId(process.getComputeResourceId());
        processResource.setApplicationInterfaceId(process.getApplicationInterfaceId());
        processResource.setStorageResourceId(process.getStorageResourceId());
        processResource.setUserDn(process.getUserDn());
        processResource.setGenerateCert(process.isGenerateCert());
        processResource.setExperimentDataDir(process.getExperimentDataDir());
        processResource.setUserName(process.getUserName());
        processResource.setUseUserCRPref(process.isUseUserCRPref());
        if (process.isEnableEmailNotification()) {
            processResource.setEnableEmailNotification(true);
            if (process.getEmailAddresses() != null) {
                processResource.setEmailAddresses(StringUtils.join(process.getEmailAddresses(), ","));
            }
        } else {
            processResource.setEnableEmailNotification(false);
        }
        processResource.save();
        if (process.getProcessResourceSchedule() != null) {
            addProcessResourceSchedule(process.getProcessResourceSchedule(), process.getProcessId());
        }
        if (process.getProcessInputs() != null && process.getProcessInputs().size() > 0) {
            addProcessInputs(process.getProcessInputs(), process.getProcessId());
        }
        if (process.getProcessOutputs() != null && process.getProcessOutputs().size() > 0) {
            addProcessOutputs(process.getProcessOutputs(), process.getProcessId());
        }
        ProcessStatus processStatus = new ProcessStatus();
        processStatus.setState(ProcessState.CREATED);
        List<ProcessStatus> processStatuses = new ArrayList<>();
        processStatuses.add(processStatus);
        addProcessStatus(processStatuses.get(0), process.getProcessId());
        if (process.getProcessErrors() != null) {
            addProcessError(process.getProcessErrors().get(0), process.getProcessId());
        }
    } catch (Exception e) {
        logger.error(expId, "Error while adding process...", e);
        throw new RegistryException(e);
    }
    return process.getProcessId();
}
Also used : RegistryException(org.apache.airavata.registry.cpi.RegistryException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 72 with RegistryException

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

the class ExperimentRegistry method addProcessResourceSchedule.

public String addProcessResourceSchedule(ComputationalResourceSchedulingModel resourceSchedule, String processID) throws RegistryException {
    try {
        ProcessResourceScheduleResource processResourceSchedule = new ProcessResourceScheduleResource();
        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 user config 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 73 with RegistryException

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

the class ExperimentRegistry method addProcessOutputs.

public String addProcessOutputs(List<OutputDataObjectType> processOutput, String processID) throws RegistryException {
    try {
        for (OutputDataObjectType output : processOutput) {
            ProcessOutputResource resource = new ProcessOutputResource();
            resource.setProcessId(processID);
            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();
        }
        return processID;
    } catch (Exception e) {
        logger.error("Error while adding 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 74 with RegistryException

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

the class ExperimentRegistry method updateExpOutputs.

public void updateExpOutputs(List<OutputDataObjectType> exOutput, String expId) throws RegistryException {
    try {
        ExperimentResource experiment = gatewayResource.getExperiment(expId);
        List<ExperimentOutputResource> existingExpOutputs = experiment.getExperimentOutputs();
        for (OutputDataObjectType output : exOutput) {
            for (ExperimentOutputResource resource : existingExpOutputs) {
                if (resource.getOutputName().equals(output.getName())) {
                    resource.setExperimentId(expId);
                    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 experiment 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 75 with RegistryException

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

the class ExperimentRegistry method removeProcess.

public void removeProcess(String processId) throws RegistryException {
    try {
        ExperimentResource experiment = new ExperimentResource();
        experiment.remove(ResourceType.PROCESS, 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