Search in sources :

Example 36 with RegistryServiceException

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;
    }
}
Also used : ApplicationDeploymentDescription(org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) ApplicationInterfaceDescription(org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)

Example 37 with RegistryServiceException

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;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) Notification(org.apache.airavata.model.workspace.Notification)

Example 38 with RegistryServiceException

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;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 39 with RegistryServiceException

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;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 40 with RegistryServiceException

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;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) TException(org.apache.thrift.TException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException)

Aggregations

RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)131 TException (org.apache.thrift.TException)28 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)26 GatewayResourceProfile (org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile)9 UserResourceProfile (org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile)5 ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)4 ApplicationInterfaceDescription (org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)4 UserComputeResourcePreference (org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference)4 UserStoragePreference (org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference)4 DataProductModel (org.apache.airavata.model.data.replica.DataProductModel)4 JobModel (org.apache.airavata.model.job.JobModel)3 ProcessModel (org.apache.airavata.model.process.ProcessModel)3 ExperimentState (org.apache.airavata.model.status.ExperimentState)3 ExperimentStatus (org.apache.airavata.model.status.ExperimentStatus)3 Project (org.apache.airavata.model.workspace.Project)3 CredentialStoreService (org.apache.airavata.credential.store.cpi.CredentialStoreService)2 ApplicationModule (org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule)2 ComputeResourcePreference (org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)2 StoragePreference (org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference)2 PasswordCredential (org.apache.airavata.model.credential.store.PasswordCredential)2