Package org.apache.airavata.model.appcatalog.gatewayprofile

Examples of org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile$GatewayResourceProfileStandardScheme


            appCatalog = AppCatalogFactory.getAppCatalog();
            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
            if (!gatewayProfile.isGatewayResourceProfileExists(gatewayID)){
              throw new AppCatalogException("Gateway resource profile '"+gatewayID+"' does not exist!!!");
            }
            GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID);
//            gatewayProfile.removeGatewayResourceProfile(gatewayID);
            profile.addToComputeResourcePreferences(computeResourcePreference);
            gatewayProfile.updateGatewayResourceProfile(gatewayID, profile);
            return true;
        } catch (AppCatalogException e) {
            logger.error("Error while registering gateway resource profile preference...", e);
            AiravataSystemException exception = new AiravataSystemException();
View Full Code Here


    @Override
    public boolean updateGatewayComputeResourcePreference(String gatewayID, String computeResourceId, ComputeResourcePreference computeResourcePreference) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
      try {
            appCatalog = AppCatalogFactory.getAppCatalog();
            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
            GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID);
            List<ComputeResourcePreference> computeResourcePreferences = profile.getComputeResourcePreferences();
            ComputeResourcePreference preferenceToRemove = null;
            for (ComputeResourcePreference preference : computeResourcePreferences) {
        if (preference.getComputeResourceId().equals(computeResourceId)){
          preferenceToRemove=preference;
          break;
        }
      }
            if (preferenceToRemove!=null) {
        profile.getComputeResourcePreferences().remove(
            preferenceToRemove);
      }
            profile.getComputeResourcePreferences().add(computeResourcePreference);
            gatewayProfile.updateGatewayResourceProfile(gatewayID, profile);
            return true;
        } catch (AppCatalogException e) {
            logger.error("Error while reading gateway compute resource preference...", e);
            AiravataSystemException exception = new AiravataSystemException();
View Full Code Here

    }

    @Test
    public void gatewayProfileTest() throws Exception {
        GwyResourceProfile gatewayProfile = appcatalog.getGatewayProfile();
        GatewayResourceProfile gf = new GatewayResourceProfile();
        gf.setGatewayName("test");
        gf.setGatewayDescription("test gateway");
        ComputeResource computeRs = appcatalog.getComputeResource();
        ComputeResourceDescription cm1 = new ComputeResourceDescription();
        cm1.setHostName("localhost");
        cm1.setResourceDescription("test compute host");
        String hostId1 = computeRs.addComputeResource(cm1);

        ComputeResourceDescription cm2 = new ComputeResourceDescription();
        cm2.setHostName("localhost");
        cm2.setResourceDescription("test compute host");
        String hostId2 = computeRs.addComputeResource(cm2);

        ComputeResourcePreference preference1 = new ComputeResourcePreference();
        preference1.setComputeResourceId(hostId1);
        preference1.setOverridebyAiravata(true);
        preference1.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.SSH.toString());
        preference1.setPreferredDataMovementProtocol(DataMovementProtocol.SCP.toString());
        preference1.setPreferredBatchQueue("queue1");
        preference1.setScratchLocation("/tmp");
        preference1.setAllocationProjectNumber("project1");

        ComputeResourcePreference preference2 = new ComputeResourcePreference();
        preference2.setComputeResourceId(hostId2);
        preference2.setOverridebyAiravata(true);
        preference2.setPreferredJobSubmissionProtocol(JobSubmissionProtocol.LOCAL.toString());
        preference2.setPreferredDataMovementProtocol(DataMovementProtocol.GridFTP.toString());
        preference2.setPreferredBatchQueue("queue2");
        preference2.setScratchLocation("/tmp");
        preference2.setAllocationProjectNumber("project2");

        List<ComputeResourcePreference> list = new ArrayList<ComputeResourcePreference>();
        list.add(preference1);
        list.add(preference2);
        gf.setComputeResourcePreferences(list);

        String gwId = gatewayProfile.addGatewayResourceProfile(gf);
        GatewayResourceProfile retrievedProfile = null;
        if (gatewayProfile.isGatewayResourceProfileExists(gwId)){
            retrievedProfile = gatewayProfile.getGatewayProfile(gwId);
            System.out.println("************ gateway name ************** :" + retrievedProfile.getGatewayName());
        }
        List<ComputeResourcePreference> preferences = gatewayProfile.getAllComputeResourcePreferences(gwId);
        System.out.println("compute preferences size : " + preferences.size());
        if (preferences != null && !preferences.isEmpty()){
            for (ComputeResourcePreference cm : preferences){
View Full Code Here

        }
        return preferences;
    }

    public static GatewayResourceProfile getGatewayResourceProfile(GatewayProfileResource gw, List<ComputeResourcePreference> preferences){
        GatewayResourceProfile gatewayProfile = new GatewayResourceProfile();
        gatewayProfile.setGatewayID(gw.getGatewayID());
        gatewayProfile.setGatewayDescription(gw.getGatewayDesc());
        gatewayProfile.setGatewayName(gw.getGatewayName());
        gatewayProfile.setComputeResourcePreferences(preferences);
        return gatewayProfile;
    }
View Full Code Here

            ComputeResourcePreference bigRedResourcePreferences = RegisterSampleApplicationsUtils.
                    createComputeResourcePreference(bigredResourceId, "TG-STA110014S", false, null, null, null,
                            "/N/dc2/scratch/cgateway/gta-work-dirs");

            GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
            gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY);
            gatewayResourceProfile.setGatewayName(DEFAULT_GATEWAY);
            gatewayResourceProfile.addToComputeResourcePreferences(stampedeResourcePreferences);
            gatewayResourceProfile.addToComputeResourcePreferences(trestlesResourcePreferences);
            gatewayResourceProfile.addToComputeResourcePreferences(bigRedResourcePreferences);

            String gatewayProfile = airavataClient.registerGatewayResourceProfile(gatewayResourceProfile);
            System.out.println("Gateway Profile is registered with Id " + gatewayProfile);

        } catch (TException e) {
View Full Code Here

    @Override
    public boolean deleteGatewayComputeResourcePreference(String gatewayID, String computeResourceId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
      try {
            appCatalog = AppCatalogFactory.getAppCatalog();
            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
            GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID);
            List<ComputeResourcePreference> computeResourcePreferences = profile.getComputeResourcePreferences();
            ComputeResourcePreference preferenceToRemove = null;
            for (ComputeResourcePreference preference : computeResourcePreferences) {
        if (preference.getComputeResourceId().equals(computeResourceId)){
          preferenceToRemove=preference;
          break;
        }
      }
            if (preferenceToRemove!=null) {
        profile.getComputeResourcePreferences().remove(
            preferenceToRemove);
      }
            gatewayProfile.updateGatewayResourceProfile(gatewayID, profile);
            return true;
        } catch (AppCatalogException e) {
View Full Code Here

        //Define gateway profile
        ComputeResourcePreference computeResourcePreference = DocumentCreatorUtils.createComputeResourcePreference(
                host.getComputeResourceId(), "/tmp", null,
                false, null,
                null, null);
        gatewayResourceProfile = new GatewayResourceProfile();
//    gatewayResourceProfile.setGatewayID("default");
        gatewayResourceProfile.setGatewayName(ClientSettings.getSetting("gateway_id", "php_reference_gateway"));
        gatewayResourceProfile.addToComputeResourcePreferences(computeResourcePreference);
        String gatewayId = client.registerGatewayResourceProfile(gatewayResourceProfile);
        gatewayResourceProfile.setGatewayID(gatewayId);
View Full Code Here

//        gatewayResourceProfile = client.getGatewayResourceProfile(ga);
//      } catch (Exception e) {
//
//      }
        if (gatewayResourceProfile == null) {
            gatewayResourceProfile = new GatewayResourceProfile();
//        gatewayResourceProfile.setGatewayID("default");
            gatewayResourceProfile.setGatewayName("default");
            gatewayResourceProfile.setGatewayID(client.registerGatewayResourceProfile(gatewayResourceProfile));
        }
//      }
View Full Code Here

TOP

Related Classes of org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile$GatewayResourceProfileStandardScheme

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.