Search in sources :

Example 46 with RegistryServiceException

use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.

the class RegistryServerHandler method getProject.

/**
 * Get a Project by ID
 * This method is to obtain a project by providing a projectId.
 *
 * @param projectId projectId of the project you require.
 * @return project
 * project data model will be returned.
 */
@Override
public Project getProject(String projectId) throws RegistryServiceException, TException {
    try {
        experimentCatalog = RegistryFactory.getDefaultExpCatalog();
        if (!experimentCatalog.isExist(ExperimentCatalogModelType.PROJECT, projectId)) {
            logger.error("Project does not exist in the system. Please provide a valid project ID...");
            ProjectNotFoundException exception = new ProjectNotFoundException();
            exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
            throw exception;
        }
        logger.debug("Airavata retrieved project with project Id : " + projectId);
        Project project = (Project) experimentCatalog.get(ExperimentCatalogModelType.PROJECT, projectId);
        return project;
    } catch (RegistryException e) {
        logger.error("Error while retrieving the project", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while retrieving the project. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : Project(org.apache.airavata.model.workspace.Project) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 47 with RegistryServiceException

use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.

the class RegistryServerHandler method registerApplicationDeployment.

/**
 * Register an Application Deployment.
 *
 * @param gatewayId             ID of the gateway which is registering the new Application Deployment.
 * @param applicationDeployment Application Module Object created from the datamodel.
 * @return appDeploymentId
 * Returns a server-side generated airavata appDeployment globally unique identifier.
 */
@Override
public String registerApplicationDeployment(String gatewayId, ApplicationDeploymentDescription applicationDeployment) throws RegistryServiceException, TException {
    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...");
    }
    try {
        appCatalog = RegistryFactory.getAppCatalog();
        String deployment = appCatalog.getApplicationDeployment().addApplicationDeployment(applicationDeployment, gatewayId);
        logger.debug("Airavata registered application deployment for gateway id : " + gatewayId);
        return deployment;
    } catch (AppCatalogException e) {
        logger.error("Error while adding application deployment...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while adding application deployment. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 48 with RegistryServiceException

use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.

the class RegistryServerHandler method getGateway.

/**
 * Get Gateway details by providing gatewayId
 *
 * @param gatewayId The gateway Id of the Gateway.
 * @return gateway
 * Gateway obejct.
 */
@Override
public Gateway getGateway(String gatewayId) throws RegistryServiceException, TException {
    try {
        experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId);
        if (!experimentCatalog.isExist(ExperimentCatalogModelType.GATEWAY, gatewayId)) {
            logger.error("Gateway does not exist in the system. Please provide a valid gateway ID...");
            AiravataSystemException exception = new AiravataSystemException();
            exception.setMessage("Gateway does not exist in the system. Please provide a valid gateway ID...");
            throw exception;
        }
        Gateway gateway = (Gateway) experimentCatalog.get(ExperimentCatalogModelType.GATEWAY, gatewayId);
        logger.debug("Airavata retrieved gateway with gateway id : " + gateway.getGatewayId());
        return gateway;
    } catch (RegistryException e) {
        logger.error("Error while getting the gateway", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while getting the gateway. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) Gateway(org.apache.airavata.model.workspace.Gateway)

Example 49 with RegistryServiceException

use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.

the class RegistryServerHandler method getLocalJobSubmission.

/**
 * This method returns localJobSubmission object
 *
 * @param jobSubmissionId@return LOCALSubmission instance
 */
@Override
public LOCALSubmission getLocalJobSubmission(String jobSubmissionId) throws RegistryServiceException, TException {
    try {
        appCatalog = RegistryFactory.getAppCatalog();
        LOCALSubmission localJobSubmission = appCatalog.getComputeResource().getLocalJobSubmission(jobSubmissionId);
        logger.debug("Airavata retrieved local job submission for job submission interface id: " + jobSubmissionId);
        return localJobSubmission;
    } catch (AppCatalogException e) {
        String errorMsg = "Error while retrieving local job submission interface to resource compute resource...";
        logger.error(jobSubmissionId, errorMsg, e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage(errorMsg + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 50 with RegistryServiceException

use of org.apache.airavata.registry.api.exception.RegistryServiceException in project airavata by apache.

the class RegistryServerHandler method getGatewayComputeResourcePreference.

/**
 * Fetch a Compute Resource Preference of a registered gateway profile.
 *
 * @param gatewayID         The identifier for the gateway profile to be requested
 * @param computeResourceId Preferences related to a particular compute resource
 * @return computeResourcePreference
 * Returns the ComputeResourcePreference object.
 */
@Override
public ComputeResourcePreference getGatewayComputeResourcePreference(String gatewayID, String computeResourceId) 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();
        ComputeResource computeResource = appCatalog.getComputeResource();
        if (!gatewayProfile.isGatewayResourceProfileExists(gatewayID)) {
            logger.error(gatewayID, "Given gateway profile does not exist in the system. Please provide a valid gateway id...");
            RegistryServiceException exception = new RegistryServiceException();
            exception.setMessage("Given gateway profile does not exist in the system. Please provide a valid gateway id...");
            throw exception;
        }
        if (!computeResource.isComputeResourceExists(computeResourceId)) {
            logger.error(computeResourceId, "Given compute resource does not exist in the system. Please provide a valid compute resource id...");
            RegistryServiceException exception = new RegistryServiceException();
            exception.setMessage("Given compute resource does not exist in the system. Please provide a valid compute resource id...");
            throw exception;
        }
        ComputeResourcePreference computeResourcePreference = gatewayProfile.getComputeResourcePreference(gatewayID, computeResourceId);
        logger.debug("Airavata retrieved gateway compute resource preference with gateway id : " + gatewayID + " and for compute resoruce id : " + computeResourceId);
        return computeResourcePreference;
    } catch (AppCatalogException e) {
        logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while reading gateway compute resource preference. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : UserComputeResourcePreference(org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference) ComputeResourcePreference(org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

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