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