use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method addTaskError.
public String addTaskError(ErrorModel taskError, String taskId) throws RegistryException {
try {
TaskErrorResource error = new TaskErrorResource();
error.setTaskId(taskId);
if (taskError.getErrorId() == null) {
error.setErrorId(AiravataUtils.getId("TASK_ERROR"));
} else {
error.setErrorId(taskError.getErrorId());
}
error.setCreationTime(AiravataUtils.getTime(taskError.getCreationTime()));
error.setActualErrorMessage(taskError.getActualErrorMessage());
error.setUserFriendlyMessage(taskError.getUserFriendlyMessage());
error.setTransientOrPersistent(taskError.isTransientOrPersistent());
if (taskError.getRootCauseErrorIdList() != null) {
error.setRootCauseErrorIdList(StringUtils.join(taskError.getRootCauseErrorIdList(), ","));
}
error.save();
} catch (Exception e) {
logger.error(taskId, "Error while adding task status...", e);
throw new RegistryException(e);
}
return taskId;
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method getExperimentStatistics.
public ExperimentStatistics getExperimentStatistics(Map<String, String> filters) throws RegistryException {
try {
ExperimentStatistics experimentStatistics = new ExperimentStatistics();
ExperimentStatisticsResource experimentStatisticsResource = workerResource.getExperimentStatistics(filters.get(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID), new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.FROM_DATE))), new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.TO_DATE))), filters.get(Constants.FieldConstants.ExperimentConstants.USER_NAME), filters.get(Constants.FieldConstants.ExperimentConstants.EXECUTION_ID), filters.get(Constants.FieldConstants.ExperimentConstants.RESOURCE_HOST_ID));
experimentStatistics.setAllExperimentCount(experimentStatisticsResource.getAllExperimentCount());
experimentStatistics.setCreatedExperimentCount(experimentStatisticsResource.getCreatedExperimentCount());
experimentStatistics.setRunningExperimentCount(experimentStatisticsResource.getRunningExperimentCount());
experimentStatistics.setCompletedExperimentCount(experimentStatisticsResource.getCompletedExperimentCount());
experimentStatistics.setFailedExperimentCount(experimentStatisticsResource.getFailedExperimentCount());
experimentStatistics.setCancelledExperimentCount(experimentStatisticsResource.getCancelledExperimentCount());
ArrayList<ExperimentSummaryModel> experimentSummaries = new ArrayList();
for (ExperimentSummaryResource ex : experimentStatisticsResource.getAllExperiments()) {
experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
}
experimentStatistics.setAllExperiments(experimentSummaries);
experimentSummaries = new ArrayList();
for (ExperimentSummaryResource ex : experimentStatisticsResource.getCreatedExperiments()) {
experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
}
experimentStatistics.setCreatedExperiments(experimentSummaries);
experimentSummaries = new ArrayList();
for (ExperimentSummaryResource ex : experimentStatisticsResource.getRunningExperiments()) {
experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
}
experimentStatistics.setRunningExperiments(experimentSummaries);
experimentSummaries = new ArrayList();
for (ExperimentSummaryResource ex : experimentStatisticsResource.getCompletedExperiments()) {
experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
}
experimentStatistics.setCompletedExperiments(experimentSummaries);
experimentSummaries = new ArrayList();
for (ExperimentSummaryResource ex : experimentStatisticsResource.getFailedExperiments()) {
experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
}
experimentStatistics.setFailedExperiments(experimentSummaries);
experimentSummaries = new ArrayList();
for (ExperimentSummaryResource ex : experimentStatisticsResource.getCancelledExperiments()) {
experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
}
experimentStatistics.setCancelledExperiments(experimentSummaries);
return experimentStatistics;
} catch (RegistryException e) {
logger.error("Error while retrieving experiment statistics from registry", e);
throw new RegistryException(e);
}
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method updateUserConfigDataField.
public void updateUserConfigDataField(String expID, String fieldName, Object value) throws RegistryException {
try {
ExperimentResource experiment = new ExperimentResource();
experiment.setExperimentId(expID);
UserConfigurationDataResource exConfigData = (UserConfigurationDataResource) experiment.get(ResourceType.USER_CONFIGURATION_DATA, expID);
if (fieldName.equals(Constants.FieldConstants.UserConfigurationDataConstants.AIRAVATA_AUTO_SCHEDULE)) {
exConfigData.setAiravataAutoSchedule((Boolean) value);
exConfigData.save();
} else if (fieldName.equals(Constants.FieldConstants.UserConfigurationDataConstants.OVERRIDE_MANUAL_PARAMS)) {
exConfigData.setOverrideManualScheduledParams((Boolean) value);
exConfigData.save();
} else if (fieldName.equals(Constants.FieldConstants.UserConfigurationDataConstants.SHARE_EXP)) {
exConfigData.setShareExperimentPublically((Boolean) value);
exConfigData.save();
} else if (fieldName.equals(Constants.FieldConstants.UserConfigurationDataConstants.COMPUTATIONAL_RESOURCE_SCHEDULING)) {
updateComputeResourceScheduling((ComputationalResourceSchedulingModel) value, expID);
} else {
logger.error("Unsupported field type for Experiment config data");
}
} catch (Exception e) {
logger.error("Error while updating fields in experiment config...", e);
throw new RegistryException(e);
}
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method addProcessInputs.
public String addProcessInputs(List<InputDataObjectType> processInputs, String processID) throws RegistryException {
try {
for (InputDataObjectType input : processInputs) {
ProcessInputResource resource = new ProcessInputResource();
resource.setProcessId(processID);
resource.setInputName(input.getName());
resource.setInputValue(input.getValue());
if (input.getType() != null) {
resource.setDataType(input.getType().toString());
}
resource.setMetadata(input.getMetaData());
resource.setApplicationArgument(input.getApplicationArgument());
resource.setInputOrder(input.getInputOrder());
resource.setIsRequired(input.isIsRequired());
resource.setRequiredToAddedToCmd(input.isRequiredToAddedToCommandLine());
resource.setStorageResourceId(input.getStorageResourceId());
resource.setIsReadOnly(input.isIsReadOnly());
resource.save();
}
return processID;
} catch (Exception e) {
logger.error("Unable to save process inputs", e);
throw new RegistryException(e);
}
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method getExperimentIDs.
// CPI getIds method
public List<String> getExperimentIDs(String fieldName, Object value) throws RegistryException {
List<String> expIDs = new ArrayList<String>();
try {
if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID)) {
if (gatewayResource == null) {
logger.error("You should use an existing gateway in order to retrieve experiments..");
return null;
} else {
List<ExperimentResource> resources = gatewayResource.getExperiments();
for (ExperimentResource resource : resources) {
String expID = resource.getExperimentId();
expIDs.add(expID);
}
}
} else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.USER_NAME)) {
List<ExperimentResource> resources = workerResource.getExperiments();
for (ExperimentResource resource : resources) {
expIDs.add(resource.getExperimentId());
}
} else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.PROJECT_ID)) {
List<ExperimentResource> resources = workerResource.getExperiments();
for (ExperimentResource resource : resources) {
expIDs.add(resource.getExperimentId());
}
}
} catch (Exception e) {
logger.error("Error while retrieving experiment ids..", e);
throw new RegistryException(e);
}
return expIDs;
}
Aggregations