Package org.apache.airavata.model.appcatalog.computeresource

Examples of org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription$ComputeResourceDescriptionTupleSchemeFactory


        this.client = client;
    }

    public String createLocalHostDocs() throws AppCatalogException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
        //Define compute resource host
        ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(
                "localhost", new HashSet<String>(Arrays.asList(new String[]{"127.0.0.1"})), new HashSet<String>(Arrays.asList(new String[]{"127.0.0.1"})));
//      host.setIsEmpty(true);
        host.setComputeResourceId(client.registerComputeResource(host));

        LOCALSubmission localSubmission = new LOCALSubmission();
        ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.FORK, null, null, null);
        localSubmission.setResourceJobManager(resourceJobManager);
        client.addLocalSubmissionDetails(host.getComputeResourceId(), 1, localSubmission);

        LOCALDataMovement localDataMovement = new LOCALDataMovement();
        client.addLocalDataMovementDetails(host.getComputeResourceId(), 1, localDataMovement);

        //Define application module
        ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.0.0", "Local host echo applications");
        module.setAppModuleId(client.registerApplicationModule(module));

        //Define application interfaces
        ApplicationInterfaceDescription application = new ApplicationInterfaceDescription();
//      application.setIsEmpty(false);
        application.setApplicationName("SimpleEcho0");
        application.addToApplicationModules(module.getAppModuleId());
        application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", "Echo Input Data", null, DataType.STRING));
        application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING));
        application.setApplicationInterfaceId(client.registerApplicationInterface(application));

        //Define application deployment
        ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "Local echo app depoyment");
        deployment.setAppDeploymentId(client.registerApplicationDeployment(deployment));

        //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);
        client.addGatewayComputeResourcePreference(gatewayResourceProfile.getGatewayID(), host.getComputeResourceId(), computeResourcePreference);
        return host.getComputeResourceId() + "," + application.getApplicationInterfaceId();
    }
View Full Code Here


        return gatewayResourceProfile;

    }

    public String createSSHHostDocs() throws AppCatalogException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
        ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription("gw111.iu.xsede.org", null, null);
        host.addToIpAddresses("gw111.iu.xsede.org");
        host.addToHostAliases("gw111.iu.xsede.org");
        host.setResourceDescription("gw111 ssh access");
        host.setComputeResourceId(client.registerComputeResource(host));


        SSHJobSubmission jobSubmission = new SSHJobSubmission();
        jobSubmission.setSshPort(22);
        jobSubmission.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
        ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.FORK, null, null, null);
        jobSubmission.setResourceJobManager(resourceJobManager);
        client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, jobSubmission);

        SCPDataMovement scpDataMovement = new SCPDataMovement();
        scpDataMovement.setSecurityProtocol(SecurityProtocol.SSH_KEYS);
        scpDataMovement.setSshPort(22);
        client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement);

        ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.1", null);
        module.setAppModuleId(client.registerApplicationModule(module));
        ;

        ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "SSHEchoApplication");
        client.registerApplicationDeployment(deployment);

        ApplicationInterfaceDescription application = new ApplicationInterfaceDescription();
//      application.setIsEmpty(false);
        application.setApplicationName("SSHEcho1");
        application.addToApplicationModules(module.getAppModuleId());
        application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", null, null, DataType.STRING));
        application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING));
        client.registerApplicationInterface(application);
        client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/tmp", null, false, null, null, null));
        return host.getComputeResourceId() + "," + application.getApplicationInterfaceId();
    }
View Full Code Here

////        }
//    }
//
    public String createPBSDocsForOGCE_Echo() throws AppCatalogException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException {

        ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(trestleshpcHostAddress, null, null);
        host.addToIpAddresses(trestleshpcHostAddress);
        host.addToHostAliases(trestleshpcHostAddress);
        host.setComputeResourceId(client.registerComputeResource(host));

        SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
        ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.PBS, "/opt/torque/bin/", null, null);
        sshJobSubmission.setResourceJobManager(resourceJobManager);
        sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
        sshJobSubmission.setSshPort(22);
        client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission);

        SCPDataMovement scpDataMovement = new SCPDataMovement();
        scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI);
        scpDataMovement.setSshPort(22);

        client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement);

        ApplicationModule module1 = DocumentCreatorUtils.createApplicationModule("echo", "1.2", null);
        module1.setAppModuleId(client.registerApplicationModule(module1));

        ApplicationInterfaceDescription application = new ApplicationInterfaceDescription();
//      application.setIsEmpty(false);
        application.setApplicationName("SimpleEcho2");
        application.addToApplicationModules(module1.getAppModuleId());
        application.addToApplicationInputs(DocumentCreatorUtils.createAppInput("echo_input", "echo_input", "echo_input", null, DataType.STRING));
        application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("echo_output", null, DataType.STRING));

        application.setApplicationInterfaceId(client.registerApplicationInterface(application));

        ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module1.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "Echo application");
        deployment.setAppDeploymentId(client.registerApplicationDeployment(deployment));

        client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/oasis/scratch/trestles/ogce/temp_project/", "sds128", false, null, null, null));
        return host.getComputeResourceId() + "," + application.getApplicationInterfaceId();
    }
View Full Code Here

        return host.getComputeResourceId() + "," + application.getApplicationInterfaceId();
    }

    public String createPBSDocsForOGCE_WRF() throws AppCatalogException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException {

        ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(trestleshpcHostAddress, null, null);
        host.addToIpAddresses(trestleshpcHostAddress);
        host.addToHostAliases(trestleshpcHostAddress);
        host.setComputeResourceId(client.registerComputeResource(host));

        SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
        ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.PBS, "/opt/torque/bin/", null, null);
        sshJobSubmission.setResourceJobManager(resourceJobManager);
        sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
        sshJobSubmission.setSshPort(22);
        client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission);

        SCPDataMovement scpDataMovement = new SCPDataMovement();
        scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI);
        scpDataMovement.setSshPort(22);

        client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement);

        client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/oasis/scratch/trestles/ogce/temp_project/", "sds128", false, null, null, null));

        ApplicationModule module2 = DocumentCreatorUtils.createApplicationModule("wrf", "1.0.0", null);
        module2.setAppModuleId(client.registerApplicationModule(module2));
        ApplicationInterfaceDescription application2 = new ApplicationInterfaceDescription();
//      application2.setIsEmpty(false);
        application2.setApplicationName("WRF");
        application2.addToApplicationModules(module2.getAppModuleId());
        application2.addToApplicationInputs(DocumentCreatorUtils.createAppInput("WRF_Namelist", "WRF_Namelist", null, null, DataType.URI));
        application2.addToApplicationInputs(DocumentCreatorUtils.createAppInput("WRF_Boundary_File", "WRF_Boundary_File", null, null, DataType.URI));
        application2.addToApplicationInputs(DocumentCreatorUtils.createAppInput("WRF_Input_File", "WRF_Input_File", null, null, DataType.URI));

        application2.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("WRF_Output", null, DataType.URI));
        application2.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("WRF_Execution_Log", null, DataType.URI));
        application2.setApplicationInterfaceId(client.registerApplicationInterface(application2));

        ApplicationDeploymentDescription deployment2 = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module2.getAppModuleId(), "/home/ogce/production/app_wrappers/wrf_wrapper.sh", ApplicationParallelismType.MPI, "WRF");
        deployment2.setAppDeploymentId(client.registerApplicationDeployment(deployment2));
        return host.getComputeResourceId() + "," + application2.getApplicationInterfaceId();
    }
View Full Code Here

        deployment2.setAppDeploymentId(client.registerApplicationDeployment(deployment2));
        return host.getComputeResourceId() + "," + application2.getApplicationInterfaceId();
    }

    public String createSlumWRFDocs() throws AppCatalogException, TException {
        ComputeResourceDescription host = DocumentCreatorUtils.createComputeResourceDescription(stampedeHostAddress, null, null);
        host.addToHostAliases(stampedeHostAddress);
        host.addToIpAddresses(stampedeHostAddress);
        host.setComputeResourceId(client.registerComputeResource(host));

        ResourceJobManager resourceJobManager = DocumentCreatorUtils.createResourceJobManager(ResourceJobManagerType.SLURM, "/usr/bin/", null, "push");
        SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
        sshJobSubmission.setResourceJobManager(resourceJobManager);
        sshJobSubmission.setSecurityProtocol(SecurityProtocol.GSI);
        sshJobSubmission.setSshPort(2222);

        client.addSSHJobSubmissionDetails(host.getComputeResourceId(), 1, sshJobSubmission);
        SCPDataMovement scpDataMovement = new SCPDataMovement();
        scpDataMovement.setSecurityProtocol(SecurityProtocol.GSI);
        scpDataMovement.setSshPort(22);
        client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement);
        client.addSCPDataMovementDetails(host.getComputeResourceId(), 1, scpDataMovement);

        client.addGatewayComputeResourcePreference(getGatewayResourceProfile().getGatewayID(), host.getComputeResourceId(), DocumentCreatorUtils.createComputeResourcePreference(host.getComputeResourceId(), "/home1/01437/ogce", "TG-STA110014S", false, null, null, null));

        ApplicationModule module2 = DocumentCreatorUtils.createApplicationModule("wrf", "1.0.0", null);
        module2.setAppModuleId(client.registerApplicationModule(module2));
        ApplicationInterfaceDescription application2 = new ApplicationInterfaceDescription();
        //      application2.setIsEmpty(false);
        application2.setApplicationName("WRF");
        application2.addToApplicationModules(module2.getAppModuleId());
        application2.addToApplicationInputs(DocumentCreatorUtils.createAppInput("WRF_Namelist", "WRF_Namelist", null, null, DataType.URI));
        application2.addToApplicationInputs(DocumentCreatorUtils.createAppInput("WRF_Boundary_File", "WRF_Boundary_File", null, null, DataType.URI));
        application2.addToApplicationInputs(DocumentCreatorUtils.createAppInput("WRF_Input_File", "WRF_Input_File", null, null, DataType.URI));

        application2.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("WRF_Output", null, DataType.URI));
        application2.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("WRF_Execution_Log", null, DataType.URI));
        application2.setApplicationInterfaceId(client.registerApplicationInterface(application2));

        ApplicationDeploymentDescription deployment2 = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module2.getAppModuleId(), "/home1/01437/ogce/production/app_wrappers/wrf_wrapper.sh", ApplicationParallelismType.MPI, "WRF");
        deployment2.setAppDeploymentId(client.registerApplicationDeployment(deployment2));
        return host.getComputeResourceId() + "," + application2.getApplicationInterfaceId();

    }
View Full Code Here

    @Test
    public void testAppDeployment () throws Exception {
        ApplicationDeployment appDep = appcatalog.getApplicationDeployment();
        ApplicationInterface appInt = appcatalog.getApplicationInterface();
        ComputeResource computeRs = appcatalog.getComputeResource();
        ComputeResourceDescription cm = new ComputeResourceDescription();
        cm.setHostName("localhost");
        cm.setResourceDescription("test compute host");
        String hostId = computeRs.addComputeResource(cm);

        ApplicationModule module = new ApplicationModule();
        module.setAppModuleName("WRF");
        module.setAppModuleVersion("1.0.0");
View Full Code Here

        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);
View Full Code Here

        resource.setResourceId(description.getComputeResourceId());
        return resource;
    }

    public static ComputeResourceDescription getComputeHostDescription (ComputeResourceResource resource) throws AppCatalogException{
        ComputeResourceDescription description = new ComputeResourceDescription();
        description.setComputeResourceId(resource.getResourceId());
        description.setHostName(resource.getHostName());
        description.setResourceDescription(resource.getResourceDescription());
        HostAliasResource aliasResource = new HostAliasResource();
        List<Resource> resources = aliasResource.get(AbstractResource.HostAliasConstants.RESOURCE_ID, resource.getResourceId());
        if (resources != null && !resources.isEmpty()){
            description.setHostAliases(getHostAliases(resources));
        }
        HostIPAddressResource ipAddressResource = new HostIPAddressResource();
        List<Resource> ipAddresses = ipAddressResource.get(AbstractResource.HostIPAddressConstants.RESOURCE_ID, resource.getResourceId());
        if (ipAddresses != null && !ipAddresses.isEmpty()){
            description.setIpAddresses(getIpAddresses(ipAddresses));
        }

        BatchQueueResource bqResource = new BatchQueueResource();
        List<Resource> batchQueues = bqResource.get(AbstractResource.BatchQueueConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
        if (batchQueues != null && !batchQueues.isEmpty()){
            description.setBatchQueues(getBatchQueues(batchQueues));
        }
       
        ComputeResourceFileSystemResource fsResource = new ComputeResourceFileSystemResource();
        List<Resource> fsList = fsResource.get(AbstractResource.ComputeResourceFileSystemConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
        description.setFileSystems(new HashMap<FileSystems,String>());
        if (fsList != null && !fsList.isEmpty()){
          for (Resource r : fsList) {
            ComputeResourceFileSystemResource rr=(ComputeResourceFileSystemResource)r;
            description.getFileSystems().put(FileSystems.valueOf(rr.getFileSystem()), rr.getPath());
      }
        }
       
        JobSubmissionInterfaceResource jsiResource = new JobSubmissionInterfaceResource();
        List<Resource> hsiList = jsiResource.get(AbstractResource.JobSubmissionInterfaceConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
        if (hsiList != null && !hsiList.isEmpty()){
            description.setJobSubmissionInterfaces(getJobSubmissionInterfaces(hsiList));
        }
       
        DataMovementInterfaceResource dmiResource = new DataMovementInterfaceResource();
        List<Resource> dmiList = dmiResource.get(AbstractResource.DataMovementInterfaceConstants.COMPUTE_RESOURCE_ID, resource.getResourceId());
        if (dmiList != null && !dmiList.isEmpty()){
            description.setDataMovementInterfaces(getDataMovementInterfaces(dmiList));
        }
        return description;
    }
View Full Code Here

    List<ComputeResourceDescription> computeHostList = Arrays.asList(deploymentMap.keySet().toArray(new ComputeResourceDescription[]{}))
    Class<? extends HostScheduler> aClass = Class.forName(
        ServerSettings.getHostScheduler()).asSubclass(
        HostScheduler.class);
    HostScheduler hostScheduler = aClass.newInstance();
    ComputeResourceDescription ComputeResourceDescription = hostScheduler.schedule(computeHostList);
    ApplicationDeploymentDescription applicationDeploymentDescription = deploymentMap.get(ComputeResourceDescription);
    return applicationDeploymentDescription;
  }
View Full Code Here

    return jobSubmissionInterface;
  }

  public static ComputeResourceDescription createComputeResourceDescription(
      String hostName, Set<String> hostAliases, Set<String> ipAddresses) {
    ComputeResourceDescription host = new ComputeResourceDescription();
    host.setHostName(hostName);
    host.setIpAddresses(ipAddresses);
    host.setHostAliases(hostAliases);
    return host;
  }
View Full Code Here

TOP

Related Classes of org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription$ComputeResourceDescriptionTupleSchemeFactory

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.