use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method getAvailableAppInterfaceComputeResources.
/**
* Fetch a list of all deployed Compute Hosts for a given application interfaces.
*
* @param appInterfaceId The identifier for the requested application interface.
* @return map<computeResourceId, computeResourceName>
* A map of registered compute resource id's and their corresponding hostnames.
* Deployments of each modules listed within the interfaces will be listed.
*/
@Override
public Map<String, String> getAvailableAppInterfaceComputeResources(String appInterfaceId) throws RegistryServiceException, TException {
try {
appCatalog = RegistryFactory.getAppCatalog();
ApplicationDeployment applicationDeployment = appCatalog.getApplicationDeployment();
Map<String, String> allComputeResources = appCatalog.getComputeResource().getAvailableComputeResourceIdList();
Map<String, String> availableComputeResources = new HashMap<String, String>();
ApplicationInterfaceDescription applicationInterface = appCatalog.getApplicationInterface().getApplicationInterface(appInterfaceId);
HashMap<String, String> filters = new HashMap<String, String>();
List<String> applicationModules = applicationInterface.getApplicationModules();
if (applicationModules != null && !applicationModules.isEmpty()) {
for (String moduleId : applicationModules) {
filters.put(AppCatAbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, moduleId);
List<ApplicationDeploymentDescription> applicationDeployments = applicationDeployment.getApplicationDeployements(filters);
for (ApplicationDeploymentDescription deploymentDescription : applicationDeployments) {
if (allComputeResources.get(deploymentDescription.getComputeHostId()) != null) {
availableComputeResources.put(deploymentDescription.getComputeHostId(), allComputeResources.get(deploymentDescription.getComputeHostId()));
}
}
}
}
logger.debug("Airavata retrieved available compute resources for application interface id : " + appInterfaceId);
return availableComputeResources;
} catch (AppCatalogException e) {
logger.error(appInterfaceId, "Error while saving compute resource...", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while saving 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 getAllNotifications.
@Override
public List<Notification> getAllNotifications(String gatewayId) throws RegistryServiceException, TException {
try {
experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId);
List<Object> objectList = experimentCatalog.get(ExperimentCatalogModelType.NOTIFICATION, null, gatewayId);
List<Notification> notifications = new ArrayList<>();
for (Object o : objectList) notifications.add((Notification) o);
return notifications;
} catch (RegistryException e) {
logger.error("Error while getting all notifications", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while getting all notifications. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method getUnicoreDataMovement.
/**
* This method returns UNICORE datamovement object
*
* @param dataMovementId The identifier of the datamovement Interface to be retrieved.
* @return UnicoreDataMovement instance
*/
@Override
public UnicoreDataMovement getUnicoreDataMovement(String dataMovementId) throws RegistryServiceException, TException {
try {
appCatalog = RegistryFactory.getAppCatalog();
UnicoreDataMovement unicoreDataMovement = appCatalog.getComputeResource().getUNICOREDataMovement(dataMovementId);
logger.debug("Airavata retrieved UNICORE data movement with data movement id: " + dataMovementId);
return unicoreDataMovement;
} catch (AppCatalogException e) {
String errorMsg = "Error while retrieving UNICORE data movement interface...";
logger.error(dataMovementId, errorMsg, e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage(errorMsg + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method updateApplicationModule.
/**
* Update a Application Module.
*
* @param appModuleId The identifier for the requested application module to be updated.
* @param applicationModule Application Module Object created from the datamodel.
* @return status
* Returns a success/failure of the update.
*/
@Override
public boolean updateApplicationModule(String appModuleId, ApplicationModule applicationModule) throws RegistryServiceException, TException {
try {
appCatalog = RegistryFactory.getAppCatalog();
appCatalog.getApplicationInterface().updateApplicationModule(appModuleId, applicationModule);
logger.debug("Airavata updated application module with module id: " + appModuleId);
return true;
} catch (AppCatalogException e) {
logger.error(appModuleId, "Error while updating application module...", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while updating application module. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.
the class RegistryServerHandler method updateGridFTPDataMovementDetails.
/**
* Update the given GridFTP data movement details to a compute resource
* App catalog will return a dataMovementInterfaceId which will be added to the dataMovementInterfaces.
*
* @param dataMovementInterfaceId The identifier of the data movement Interface to be updated.
* @param gridFTPDataMovement The GridFTPDataMovement object to be updated.
* @return boolean
* Returns a success/failure of the update.
*/
@Override
public boolean updateGridFTPDataMovementDetails(String dataMovementInterfaceId, GridFTPDataMovement gridFTPDataMovement) throws RegistryServiceException, TException {
try {
GridftpDataMovementResource movment = AppCatalogThriftConversion.getGridFTPDataMovementDescription(gridFTPDataMovement);
movment.setDataMovementInterfaceId(dataMovementInterfaceId);
movment.save();
logger.debug("Airavata updated GRIDFTP data movement with data movement id: " + dataMovementInterfaceId);
return true;
} catch (Exception e) {
logger.error(dataMovementInterfaceId, "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