Search in sources :

Example 26 with ComputeResourcePreference

use of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference in project airavata by apache.

the class RegisterOGCEUS3Application method registerGatewayResourceProfile.

public static void registerGatewayResourceProfile() {
    try {
        System.out.println("#### Registering Gateway proflie #### \n");
        ComputeResourcePreference stampedeResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(stampedeResourceId, "TG-STA110014S", false, null, null, null, "/scratch/01437/ogce/ultrascan_testing/");
        ComputeResourcePreference trestlesResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(trestlesResourceId, "sds128", false, null, null, null, "/oasis/scratch/trestles/ogce/temp_project/gta-work-dirs/");
        // ComputeResourcePreference lonestarResourcePreferences = RegisterSampleApplicationsUtils.
        // createComputeResourcePreference(lonestarResourceId, "ULTRASCAN", false, null, null, null,
        // "/scratch/01623/us3/airavata/");
        // 
        // ComputeResourcePreference alamoResourcePreferences = RegisterSampleApplicationsUtils.
        // createComputeResourcePreference(alamoResourceId, null, false, null, null, null,
        // "/mnt/glusterfs/work/");
        GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
        gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY);
        gatewayResourceProfile.addToComputeResourcePreferences(stampedeResourcePreferences);
        gatewayResourceProfile.addToComputeResourcePreferences(trestlesResourcePreferences);
        // gatewayResourceProfile.addToComputeResourcePreferences(lonestarResourcePreferences);
        // gatewayResourceProfile.addToComputeResourcePreferences(alamoResourcePreferences);
        String gatewayProfile = airavataClient.registerGatewayResourceProfile(new AuthzToken(""), gatewayResourceProfile);
        System.out.println("Gateway Profile is registered with Id " + gatewayProfile);
    } catch (TException e) {
        e.printStackTrace();
    }
}
Also used : TException(org.apache.thrift.TException) ComputeResourcePreference(org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference) GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 27 with ComputeResourcePreference

use of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference in project airavata by apache.

the class AiravataServerHandler 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
@SecurityCheck
public ComputeResourcePreference getGatewayComputeResourcePreference(AuthzToken authzToken, String gatewayID, String computeResourceId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
    RegistryService.Client regClient = registryClientPool.getResource();
    try {
        ComputeResourcePreference result = regClient.getGatewayComputeResourcePreference(gatewayID, computeResourceId);
        registryClientPool.returnResource(regClient);
        return result;
    } catch (Exception e) {
        logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
        AiravataSystemException exception = new AiravataSystemException();
        exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
        exception.setMessage("Error while reading gateway compute resource preference. More info : " + e.getMessage());
        registryClientPool.returnBrokenResource(regClient);
        throw exception;
    }
}
Also used : UserComputeResourcePreference(org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference) ComputeResourcePreference(org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference) RegistryService(org.apache.airavata.registry.api.RegistryService) SharingRegistryService(org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService) RegistryServiceException(org.apache.airavata.registry.api.exception.RegistryServiceException) CredentialStoreException(org.apache.airavata.credential.store.exception.CredentialStoreException) AiravataException(org.apache.airavata.common.exception.AiravataException) TException(org.apache.thrift.TException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) SecurityCheck(org.apache.airavata.service.security.interceptor.SecurityCheck)

Example 28 with ComputeResourcePreference

use of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference in project airavata by apache.

the class RegisterUS3Application method registerGatewayResourceProfile.

public static void registerGatewayResourceProfile() {
    try {
        System.out.println("#### Registering Gateway proflie #### \n");
        ComputeResourcePreference stampedeResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(stampedeResourceId, "TG-MCB070039N", false, null, null, null, "/scratch/01623/us3/jobs/");
        ComputeResourcePreference trestlesResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(trestlesResourceId, "uot111", false, null, null, null, "/oasis/projects/nsf/uot111/us3/airavata-workdirs/");
        ComputeResourcePreference lonestarResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(lonestarResourceId, "ULTRASCAN", false, null, null, null, "/scratch/01623/us3/airavata/");
        ComputeResourcePreference alamoResourcePreferences = RegisterSampleApplicationsUtils.createComputeResourcePreference(alamoResourceId, null, false, null, null, null, "/mnt/glusterfs/work/");
        GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
        gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY);
        gatewayResourceProfile.addToComputeResourcePreferences(stampedeResourcePreferences);
        gatewayResourceProfile.addToComputeResourcePreferences(trestlesResourcePreferences);
        gatewayResourceProfile.addToComputeResourcePreferences(lonestarResourcePreferences);
        gatewayResourceProfile.addToComputeResourcePreferences(alamoResourcePreferences);
        String gatewayProfile = airavataClient.registerGatewayResourceProfile(new AuthzToken(""), gatewayResourceProfile);
        System.out.println("Gateway Profile is registered with Id " + gatewayProfile);
    } catch (TException e) {
        e.printStackTrace();
    }
}
Also used : TException(org.apache.thrift.TException) ComputeResourcePreference(org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference) GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) AuthzToken(org.apache.airavata.model.security.AuthzToken)

Example 29 with ComputeResourcePreference

use of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference in project airavata by apache.

the class RegisterSampleApplicationsUtils method createComputeResourcePreference.

public static ComputeResourcePreference createComputeResourcePreference(String computeResourceId, String allocationProjectNumber, boolean overridebyAiravata, String preferredBatchQueue, JobSubmissionProtocol preferredJobSubmissionProtocol, DataMovementProtocol preferredDataMovementProtocol, String scratchLocation) {
    ComputeResourcePreference computeResourcePreference = new ComputeResourcePreference();
    computeResourcePreference.setComputeResourceId(computeResourceId);
    computeResourcePreference.setOverridebyAiravata(overridebyAiravata);
    computeResourcePreference.setAllocationProjectNumber(allocationProjectNumber);
    computeResourcePreference.setPreferredBatchQueue(preferredBatchQueue);
    computeResourcePreference.setPreferredDataMovementProtocol(preferredDataMovementProtocol);
    computeResourcePreference.setPreferredJobSubmissionProtocol(preferredJobSubmissionProtocol);
    computeResourcePreference.setScratchLocation(scratchLocation);
    return computeResourcePreference;
}
Also used : ComputeResourcePreference(org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)

Example 30 with ComputeResourcePreference

use of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference in project airavata by apache.

the class ComputeResourceRegister method registerGatewayResourceProfile.

public void registerGatewayResourceProfile(String computeResourceId) throws Exception {
    try {
        ComputeResourcePreference localResourcePreference = null;
        loginNamesWithResourceIds = getLoginNamesWithResourceIDs();
        List<GatewayResourceProfile> allGatewayComputeResources = airavata.getAllGatewayResourceProfiles(authzToken);
        for (GatewayResourceProfile gatewayResourceProfile : allGatewayComputeResources) {
            for (String resourceId : loginNamesWithResourceIds.keySet()) {
                String loginUserName = loginNamesWithResourceIds.get(resourceId);
                if (resourceId.equals(computeResourceId) && loginUserName.equals(LOGIN_USER)) {
                    localResourcePreference = createComputeResourcePreference(resourceId, ALLOCATION_PROJECT_NUMBER, true, BATCH_QUEUE, JobSubmissionProtocol.LOCAL, DataMovementProtocol.LOCAL, TestFrameworkConstants.SCRATCH_LOCATION, loginUserName);
                    airavata.addGatewayComputeResourcePreference(authzToken, gatewayResourceProfile.getGatewayID(), resourceId, localResourcePreference);
                }
            }
        }
    } catch (TException e) {
        logger.error("Error occured while updating gateway resource profiles", e);
        throw new Exception("Error occured while updating gateway resource profiles", e);
    }
}
Also used : TException(org.apache.thrift.TException) ComputeResourcePreference(org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference) GatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile) TException(org.apache.thrift.TException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException)

Aggregations

ComputeResourcePreference (org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference)30 GatewayResourceProfile (org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile)10 UserComputeResourcePreference (org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference)10 TException (org.apache.thrift.TException)10 AiravataException (org.apache.airavata.common.exception.AiravataException)5 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)5 ComputeResourceDescription (org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription)5 RegistryServiceException (org.apache.airavata.registry.api.exception.RegistryServiceException)5 StoragePreference (org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference)4 RegistryService (org.apache.airavata.registry.api.RegistryService)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 CredentialStoreException (org.apache.airavata.credential.store.exception.CredentialStoreException)3 JobSubmissionInterface (org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface)3 AuthzToken (org.apache.airavata.model.security.AuthzToken)3 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)3 ApplicationDeploymentDescription (org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription)2 ApplicationInterfaceDescription (org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription)2 LaunchValidationException (org.apache.airavata.model.error.LaunchValidationException)2 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)2