use of org.apache.airavata.registry.cpi.RegistryException 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);
}
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method isJobExist.
public boolean isJobExist(CompositeIdentifier cis) throws RegistryException {
String taskId = (String) cis.getTopLevelIdentifier();
String jobId = (String) cis.getSecondLevelIdentifier();
try {
TaskResource taskResource = new TaskResource();
taskResource.setTaskId(taskId);
return taskResource.isExists(ResourceType.JOB, jobId);
} catch (Exception e) {
logger.error("Error while retrieving job.....", e);
throw new RegistryException(e);
}
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method updateUserConfigData.
public String updateUserConfigData(UserConfigurationDataModel configurationData, String experimentId) throws RegistryException {
try {
ExperimentResource experimentResource = new ExperimentResource();
experimentResource.setExperimentId(experimentId);
UserConfigurationDataResource configDataResource = experimentResource.getUserConfigurationDataResource();
configDataResource.setExperimentId(experimentId);
configDataResource.setAiravataAutoSchedule(configurationData.isAiravataAutoSchedule());
configDataResource.setOverrideManualScheduledParams(configurationData.isOverrideManualScheduledParams());
configDataResource.setShareExperimentPublically(configurationData.isShareExperimentPublicly());
configDataResource.setThrottleResources(configurationData.isThrottleResources());
configDataResource.setUserDn(configurationData.getUserDN());
configDataResource.setGenerateCert(configurationData.isGenerateCert());
configDataResource.setStorageId(configurationData.getStorageId());
configDataResource.setResourceHostId(configurationData.getComputationalResourceScheduling().getResourceHostId());
configDataResource.setTotalCpuCount(configurationData.getComputationalResourceScheduling().getTotalCPUCount());
configDataResource.setNodeCount(configurationData.getComputationalResourceScheduling().getNodeCount());
configDataResource.setNumberOfThreads(configurationData.getComputationalResourceScheduling().getNumberOfThreads());
configDataResource.setQueueName(configurationData.getComputationalResourceScheduling().getQueueName());
configDataResource.setWallTimeLimit(configurationData.getComputationalResourceScheduling().getWallTimeLimit());
configDataResource.setTotalPhysicalMemory(configurationData.getComputationalResourceScheduling().getTotalPhysicalMemory());
configDataResource.setStaticWorkingDir(configurationData.getComputationalResourceScheduling().getStaticWorkingDir());
configDataResource.setExperimentDataDir(configurationData.getExperimentDataDir());
configDataResource.setUseUserCRPref(configurationData.isUseUserCRPref());
configDataResource.setOverrideLoginUserName(configurationData.getComputationalResourceScheduling().getOverrideLoginUserName());
configDataResource.setOverrideScratchLocation(configurationData.getComputationalResourceScheduling().getOverrideScratchLocation());
configDataResource.setOverrideAllocationProjectNumber(configurationData.getComputationalResourceScheduling().getOverrideAllocationProjectNumber());
configDataResource.save();
} catch (Exception e) {
logger.error("Unable to save user config data", e);
throw new RegistryException(e);
}
return experimentId;
}
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) 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();
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();
for (ExperimentResource resource : resources) {
ExperimentModel experiment = ThriftDataModelConversion.getExperiment(resource);
experiments.add(experiment);
}
return experiments;
} else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID)) {
List<ExperimentResource> resources = gatewayResource.getExperiments();
for (ExperimentResource resource : resources) {
ExperimentModel experiment = ThriftDataModelConversion.getExperiment(resource);
experiments.add(experiment);
}
return experiments;
} else {
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;
}
use of org.apache.airavata.registry.cpi.RegistryException 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);
}
}
Aggregations