Search in sources :

Example 91 with RegistryServiceException

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

the class RegistryServerHandler method registerQueueStatuses.

@Override
public void registerQueueStatuses(List<QueueStatusModel> queueStatuses) throws RegistryServiceException, TException {
    try {
        experimentCatalog = RegistryFactory.getExperimentCatalog(ServerSettings.getDefaultUserGateway());
        experimentCatalog.add(ExpCatParentDataType.QUEUE_STATUS, queueStatuses, null);
    } catch (RegistryException | ApplicationSettingsException e) {
        logger.error("Error while storing queue status models....", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while storing queue status models.... : " + e.getMessage());
        throw exception;
    }
}
Also used : ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 92 with RegistryServiceException

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

the class RegistryServerHandler method getAllGatewayResourceProfiles.

/**
 * Fetch all Gateway Profiles registered
 *
 * @return GatewayResourceProfile
 * Returns all the GatewayResourcePrifle list object.
 */
@Override
public List<GatewayResourceProfile> getAllGatewayResourceProfiles() throws RegistryServiceException, TException {
    try {
        appCatalog = RegistryFactory.getAppCatalog();
        GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
        return gatewayProfile.getAllGatewayProfiles();
    } catch (AppCatalogException e) {
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while reading retrieving all gateway profiles. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 93 with RegistryServiceException

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

the class RegistryServerHandler method deleteExperiment.

/**
 * Delete an Experiment
 * If the experiment is not already launched experiment can be deleted.
 *
 * @param experimentId@return boolean
 *                            Identifier for the success or failure of the deletion operation.
 */
@Override
public boolean deleteExperiment(String experimentId) throws RegistryServiceException, TException {
    try {
        experimentCatalog = RegistryFactory.getDefaultExpCatalog();
        if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, experimentId)) {
            throw new ExperimentNotFoundException("Requested experiment id " + experimentId + " does not exist in the system..");
        }
        ExperimentModel experimentModel = (ExperimentModel) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
        if (!(experimentModel.getExperimentStatus().get(0).getState() == ExperimentState.CREATED)) {
            logger.error("Error while deleting the experiment");
            throw new ExperimentCatalogException("Experiment is not in CREATED state. Hence cannot deleted. ID:" + experimentId);
        }
        experimentCatalog.remove(ExperimentCatalogModelType.EXPERIMENT, experimentId);
        logger.debug("Airavata removed experiment with experiment id : " + experimentId);
        return true;
    } catch (Exception e) {
        logger.error("Error while deleting the experiment", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while deleting the experiment. 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)

Example 94 with RegistryServiceException

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

the class RegistryServerHandler method getUserProjects.

/**
 * Get All User Projects
 * Get all Project for the user with pagination. Results will be ordered based on creation time DESC.
 *
 * @param gatewayId The identifier for the requested gateway.
 * @param userName  The identifier of the user.
 * @param limit     The amount results to be fetched.
 * @param offset    The starting point of the results to be fetched.
 */
@Override
public List<Project> getUserProjects(String gatewayId, String userName, int limit, int offset) throws RegistryServiceException, TException {
    if (!validateString(userName)) {
        logger.error("Username cannot be empty. Please provide a valid user..");
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Username cannot be empty. Please provide a valid user..");
        throw exception;
    }
    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...");
    }
    List<Project> projects = new ArrayList<Project>();
    try {
        if (!ExpCatResourceUtils.isUserExist(userName, gatewayId)) {
            logger.warn("User does not exist in the system. Please provide a valid user..");
            return projects;
        }
        experimentCatalog = RegistryFactory.getExperimentCatalog(gatewayId);
        Map<String, String> filters = new HashMap<String, String>();
        filters.put(Constants.FieldConstants.ProjectConstants.OWNER, userName);
        filters.put(Constants.FieldConstants.ProjectConstants.GATEWAY_ID, gatewayId);
        List<Object> list = experimentCatalog.search(ExperimentCatalogModelType.PROJECT, filters, limit, offset, Constants.FieldConstants.ProjectConstants.CREATION_TIME, ResultOrderType.DESC);
        if (list != null && !list.isEmpty()) {
            for (Object o : list) {
                projects.add((Project) o);
            }
        }
        logger.debug("Airavata retrieved projects for user : " + userName + " and gateway id : " + gatewayId);
        return projects;
    } catch (RegistryException e) {
        logger.error("Error while retrieving projects", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while retrieving projects. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : Project(org.apache.airavata.model.workspace.Project) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException)

Example 95 with RegistryServiceException

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

the class RegistryServerHandler method deleteComputeResource.

/**
 * Delete a Compute Resource.
 *
 * @param computeResourceId The identifier for the requested compute resource to be deleted.
 * @return status
 * Returns a success/failure of the deletion.
 */
@Override
public boolean deleteComputeResource(String computeResourceId) throws RegistryServiceException, TException {
    try {
        appCatalog = RegistryFactory.getAppCatalog();
        appCatalog.getComputeResource().removeComputeResource(computeResourceId);
        logger.debug("Airavata deleted compute resource with compute resource Id : " + computeResourceId);
        return true;
    } catch (AppCatalogException e) {
        logger.error(computeResourceId, "Error while deleting compute resource...", e);
        RegistryServiceException exception = new RegistryServiceException();
        exception.setMessage("Error while deleting compute resource. More info : " + e.getMessage());
        throw exception;
    }
}
Also used : 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