use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method addExpOutputs.
public String addExpOutputs(List<OutputDataObjectType> exOutput, String expId) throws RegistryException {
try {
for (OutputDataObjectType output : exOutput) {
ExperimentOutputResource resource = new ExperimentOutputResource();
resource.setExperimentId(expId);
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();
}
} catch (Exception e) {
logger.error("Error while adding experiment outputs...", e);
throw new RegistryException(e);
}
return expId;
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method isUserConfigDataExist.
public boolean isUserConfigDataExist(String expID) throws RegistryException {
try {
ExperimentResource experiment = gatewayResource.getExperiment(expID);
experiment.isExists(ResourceType.USER_CONFIGURATION_DATA, expID);
return true;
} catch (Exception e) {
logger.error("Error while retrieving experiment...", e);
throw new RegistryException(e);
}
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method getTask.
public Object getTask(String taskId, String fieldName) throws RegistryException {
try {
ProcessResource processResource = new ProcessResource();
TaskResource resource = processResource.getTask(taskId);
if (fieldName == null) {
return ThriftDataModelConversion.getTaskModel(resource);
} else if (fieldName.equals(Constants.FieldConstants.TaskConstants.TASK_ERROR)) {
return ThriftDataModelConversion.getErrorModel(resource.getTaskError());
} else if (fieldName.equals(Constants.FieldConstants.TaskConstants.TASK_STATUS)) {
return ThriftDataModelConversion.getTaskStatus(resource.getTaskStatus());
} else {
logger.error("Unsupported field name for task data..");
}
} catch (Exception e) {
logger.error("Error while getting task data..", e);
throw new RegistryException(e);
}
return null;
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method addProcessError.
public String addProcessError(ErrorModel processError, String processID) throws RegistryException {
try {
ProcessErrorResource error = new ProcessErrorResource();
error.setProcessId(processID);
if (processError.getErrorId() == null) {
error.setErrorId(AiravataUtils.getId("PROCESS_ERROR"));
} else {
error.setErrorId(processError.getErrorId());
}
error.setCreationTime(AiravataUtils.getTime(processError.getCreationTime()));
error.setActualErrorMessage(processError.getActualErrorMessage());
error.setUserFriendlyMessage(processError.getUserFriendlyMessage());
error.setTransientOrPersistent(processError.isTransientOrPersistent());
if (processError.getRootCauseErrorIdList() != null) {
error.setRootCauseErrorIdList(StringUtils.join(processError.getRootCauseErrorIdList(), ","));
}
error.save();
} catch (Exception e) {
logger.error(processID, "Error while adding process status...", e);
throw new RegistryException(e);
}
return processID;
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method getJobList.
public List<JobModel> getJobList(String fieldName, Object value) throws RegistryException {
List<JobModel> jobs = new ArrayList<JobModel>();
try {
if (fieldName.equals(Constants.FieldConstants.JobConstants.PROCESS_ID)) {
ProcessResource processResource = new ProcessResource();
processResource.setProcessId((String) value);
List<JobResource> resources = processResource.getJobList();
for (JobResource jobResource : resources) {
JobModel jobModel = ThriftDataModelConversion.getJobModel(jobResource);
JobStatusResource latestSR = jobResource.getJobStatus();
if (latestSR != null) {
JobStatus jobStatus = new JobStatus(JobState.valueOf(latestSR.getState()));
jobStatus.setReason(latestSR.getReason());
List<JobStatus> statuses = new ArrayList<>();
statuses.add(jobStatus);
jobModel.setJobStatuses(statuses);
}
jobs.add(jobModel);
}
return jobs;
} else if (fieldName.equals(Constants.FieldConstants.JobConstants.TASK_ID)) {
TaskResource taskResource = new TaskResource();
taskResource.setTaskId((String) value);
List<JobResource> resources = taskResource.getJobList();
for (JobResource jobResource : resources) {
JobModel jobModel = ThriftDataModelConversion.getJobModel(jobResource);
JobStatusResource latestSR = jobResource.getJobStatus();
if (latestSR != null) {
JobStatus jobStatus = new JobStatus(JobState.valueOf(latestSR.getState()));
jobStatus.setReason(latestSR.getReason());
List<JobStatus> statuses = new ArrayList<>();
statuses.add(jobStatus);
jobModel.setJobStatuses(statuses);
}
jobs.add(jobModel);
}
return jobs;
} else {
logger.error("Unsupported field name to retrieve job list...");
}
} catch (Exception e) {
logger.error("Error while getting job list...", e);
throw new RegistryException(e);
}
return jobs;
}
Aggregations