Search in sources :

Example 66 with RegistryServiceException

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

Example 67 with RegistryServiceException

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

Example 68 with RegistryServiceException

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;
    }
}
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 69 with RegistryServiceException

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

Example 70 with RegistryServiceException

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;
    }
}
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