use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method getAllUserComputeResourcePreferences.
/**
* Fetch all User Compute Resource Preferences of a registered User Resource Profile.
*
* @param userId
* @param gatewayID The identifier for the gateway profile to be requested
* @return computeResourcePreference
* Returns the ComputeResourcePreference object.
*/
@Override
public List<UserComputeResourcePreference> getAllUserComputeResourcePreferences(String userId, String gatewayID) throws RegistryServiceException, TException {
try {
if (!isUserExists(gatewayID, userId)) {
logger.error("User Resource Profile does not exist.Please provide a valid gateway id...");
throw new RegistryServiceException("User Resource Profile does not exist.Please provide a valid gateway id...");
}
appCatalog = RegistryFactory.getAppCatalog();
UsrResourceProfile userProfile = appCatalog.getUserResourceProfile();
return userProfile.getUserResourceProfile(userId, gatewayID).getUserComputeResourcePreferences();
} catch (AppCatalogException e) {
logger.error(userId, "Error while reading User Resource Profile compute resource preferences...", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while reading User Resource Profile compute resource preferences. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method updateExperimentConfiguration.
@Override
public void updateExperimentConfiguration(String airavataExperimentId, UserConfigurationDataModel userConfiguration) throws RegistryServiceException, TException {
try {
experimentCatalog = RegistryFactory.getDefaultExpCatalog();
if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)) {
logger.error(airavataExperimentId, "Update experiment configuration failed, experiment {} doesn't exist.", airavataExperimentId);
throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
ExperimentStatus experimentStatus = getExperimentStatusInternal(airavataExperimentId);
if (experimentStatus != null) {
ExperimentState experimentState = experimentStatus.getState();
switch(experimentState) {
case CREATED:
case VALIDATED:
case CANCELED:
case FAILED:
experimentCatalog.add(ExpCatChildDataType.USER_CONFIGURATION_DATA, userConfiguration, airavataExperimentId);
logger.debug(airavataExperimentId, "Successfully updated experiment configuration for experiment {}.", airavataExperimentId);
break;
default:
logger.error(airavataExperimentId, "Error while updating experiment {}. Update experiment is only valid for experiments " + "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given " + "experiment is in one of above statuses... ", airavataExperimentId);
AiravataSystemException exception = new AiravataSystemException();
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
exception.setMessage("Error while updating experiment. Update experiment is only valid for experiments " + "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given " + "experiment is in one of above statuses... ");
throw exception;
}
}
} catch (Exception e) {
logger.error(airavataExperimentId, "Error while updating user configuration", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while updating user configuration. " + "Update experiment is only valid for experiments " + "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given " + "experiment is in one of above statuses... " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method updateSSHJobSubmissionDetails.
/**
* Update the given SSH Job Submission details
*
* @param jobSubmissionInterfaceId The identifier of the JobSubmission Interface to be updated.
* @param sshJobSubmission The SSHJobSubmission object to be updated.
* @return status
* Returns a success/failure of the update.
*/
@Override
public boolean updateSSHJobSubmissionDetails(String jobSubmissionInterfaceId, SSHJobSubmission sshJobSubmission) throws RegistryServiceException, TException {
try {
SshJobSubmissionResource submission = AppCatalogThriftConversion.getSSHJobSubmission(sshJobSubmission);
submission.setJobSubmissionInterfaceId(jobSubmissionInterfaceId);
submission.save();
logger.debug("Airavata updated SSH job submission for job submission interface id: " + jobSubmissionInterfaceId);
return true;
} catch (Exception e) {
logger.error(jobSubmissionInterfaceId, "Error while adding job submission interface to resource compute resource...", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while adding job submission interface to resource compute resource. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method getAllGatewayComputeResourcePreferences.
/**
* Fetch all Compute Resource Preferences of a registered gateway profile.
*
* @param gatewayID The identifier for the gateway profile to be requested
* @return computeResourcePreference
* Returns the ComputeResourcePreference object.
*/
@Override
public List<ComputeResourcePreference> getAllGatewayComputeResourcePreferences(String gatewayID) throws RegistryServiceException, TException {
try {
if (!isGatewayExistInternal(gatewayID)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
}
appCatalog = RegistryFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
return gatewayProfile.getGatewayProfile(gatewayID).getComputeResourcePreferences();
} catch (AppCatalogException e) {
logger.error(gatewayID, "Error while reading gateway compute resource preferences...", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while reading gateway compute resource preferences. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method addCloudJobSubmissionDetails.
/**
* *
* * Add a Cloud Job Submission details to a compute resource
* * App catalog will return a jobSubmissionInterfaceId which will be added to the jobSubmissionInterfaces.
* *
* * @param computeResourceId
* * The identifier of the compute resource to which JobSubmission protocol to be added
* *
* * @param priorityOrder
* * Specify the priority of this job manager. If this is the only jobmanager, the priority can be zero.
* *
* * @param sshJobSubmission
* * The SSHJobSubmission object to be added to the resource.
* *
* * @return status
* * Returns the unique job submission id.
* *
* *
*
* @param computeResourceId
* @param priorityOrder
* @param cloudSubmission
*/
@Override
public String addCloudJobSubmissionDetails(String computeResourceId, int priorityOrder, CloudJobSubmission cloudSubmission) throws RegistryServiceException, TException {
try {
appCatalog = RegistryFactory.getAppCatalog();
ComputeResource computeResource = appCatalog.getComputeResource();
String submissionInterface = addJobSubmissionInterface(computeResource, computeResourceId, computeResource.addCloudJobSubmission(cloudSubmission), JobSubmissionProtocol.CLOUD, priorityOrder);
logger.debug("Airavata registered Cloud job submission for compute resource id: " + computeResourceId);
return submissionInterface;
} catch (AppCatalogException e) {
logger.error(computeResourceId, "Error while adding job submission interface to resource compute resource...", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while adding job submission interface to resource compute resource. More info : " + e.getMessage());
throw exception;
}
}
Aggregations