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();
}
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;
}
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);
}
}
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);
}
}
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);
}
}
Aggregations