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

Examples of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference$ComputeResourcePreferenceTupleScheme


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


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

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

        }
        return pathList;
    }

    public static ComputeResourcePreference getComputeResourcePreference (ComputeHostPreferenceResource resource){
        ComputeResourcePreference preference = new ComputeResourcePreference();
        preference.setComputeResourceId(resource.getResourceId());
        preference.setOverridebyAiravata(resource.getOverrideByAiravata());
        preference.setPreferredJobSubmissionProtocol(resource.getPreferredJobProtocol());
        preference.setPreferredDataMovementProtocol(resource.getPreferedDMProtocol());
        preference.setPreferredBatchQueue(resource.getBatchQueue());
        preference.setScratchLocation(resource.getScratchLocation());
        preference.setAllocationProjectNumber(resource.getProjectNumber());
        return preference;
    }
View Full Code Here

    public static ComputeResourcePreference
        createComputeResourcePreference(String computeResourceId, String allocationProjectNumber,
                                        boolean overridebyAiravata, String preferredBatchQueue,
                                        String preferredJobSubmissionProtocol,String 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;
    }
View Full Code Here

        try {
            System.out.println("#### Registering Application Deployments on BigRed II #### \n");


            ComputeResourcePreference stampedeResourcePreferences = RegisterSampleApplicationsUtils.
                    createComputeResourcePreference(stampedeResourceId, "TG-STA110014S", false, null, null, null,
                            "/scratch/01437/ogce/gta-work-dirs");

            ComputeResourcePreference trestlesResourcePreferences = RegisterSampleApplicationsUtils.
                    createComputeResourcePreference(trestlesResourceId, "sds128", false, null, null, null,
                            "/oasis/scratch/trestles/ogce/temp_project/gta-work-dirs");

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

                getApplicationInterface().getApplicationInterface(applicationInterfaceId);
        ApplicationDeploymentDescription applicationDeployment = appCatalog.
                getApplicationDeployment().getApplicationDeployement(applicationDeploymentId);
        ComputeResourceDescription computeResource = appCatalog.getComputeResource().
                getComputeResource(applicationDeployment.getComputeHostId());
        ComputeResourcePreference gatewayResourcePreferences = appCatalog.getGatewayProfile().
                getComputeResourcePreference(gatewayID, applicationDeployment.getComputeHostId());
        if (gatewayResourcePreferences == null) {
            List<String> gatewayProfileIds = appCatalog.getGatewayProfile()
                    .getGatewayProfileIds(gatewayID);
            for (String profileId : gatewayProfileIds) {
                gatewayID = profileId;
                gatewayResourcePreferences = appCatalog.getGatewayProfile().
                        getComputeResourcePreference(gatewayID, applicationDeployment.getComputeHostId());
                if (gatewayResourcePreferences != null) {
                    break;
                }
            }
        }
        //Create the legacy schema docs to fill-in
        ServiceDescription legacyServiceDescription = new ServiceDescription();
        ServiceDescriptionType legacyServiceDescType = legacyServiceDescription.getType();
        ApplicationDescription legacyAppDescription = null;
        HostDescription legacyHostDescription = null;

        ///////////////SERVICE DESCRIPTOR///////////////////////////////
        //Fetch the application inputs and outputs from the app interface and create the legacy service description.
        legacyServiceDescType.setName(applicationInterface.getApplicationName());
        legacyServiceDescType.setDescription(applicationInterface.getApplicationName());
        List<InputParameterType> legacyInputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> legacyOutputParameters = new ArrayList<OutputParameterType>();
        List<InputDataObjectType> applicationInputs = applicationInterface.getApplicationInputs();
        for (InputDataObjectType dataObjectType : applicationInputs) {
            InputParameterType parameter = InputParameterType.Factory.newInstance();
            parameter.setParameterName(dataObjectType.getName());
            parameter.setParameterDescription(dataObjectType.getUserFriendlyDescription());
            ParameterType parameterType = parameter.addNewParameterType();
            switch (dataObjectType.getType()) {
                case FLOAT:
                    parameterType.setType(DataType.FLOAT);
                    break;
                case INTEGER:
                    parameterType.setType(DataType.INTEGER);
                    break;
                case STRING:
                    parameterType.setType(DataType.STRING);
                    break;
                case URI:
                    parameterType.setType(DataType.URI);
                    break;
            }
            parameterType.setName(parameterType.getType().toString());
            parameter.addParameterValue(dataObjectType.getValue());
            legacyInputParameters.add(parameter);
        }

        List<OutputDataObjectType> applicationOutputs = applicationInterface.getApplicationOutputs();
        for (OutputDataObjectType dataObjectType : applicationOutputs) {
            OutputParameterType parameter = OutputParameterType.Factory.newInstance();
            parameter.setParameterName(dataObjectType.getName());
            parameter.setParameterDescription(dataObjectType.getName());
            ParameterType parameterType = parameter.addNewParameterType();
            switch (dataObjectType.getType()) {
                case FLOAT:
                    parameterType.setType(DataType.FLOAT);
                    break;
                case INTEGER:
                    parameterType.setType(DataType.INTEGER);
                    break;
                case STRING:
                    parameterType.setType(DataType.STRING);
                    break;
                case URI:
                    parameterType.setType(DataType.URI);
                    break;
            }
            parameterType.setName(parameterType.getType().toString());
            legacyOutputParameters.add(parameter);
        }

        legacyServiceDescType.setInputParametersArray(legacyInputParameters.toArray(new InputParameterType[]{}));
        legacyServiceDescType.setOutputParametersArray(legacyOutputParameters.toArray(new OutputParameterType[]{}));

        ////////////////////-----------  HOST DESCRIPTOR  -----------------//////////////////////
        //Fetch the host description details and fill-in legacy doc
        ResourceJobManager resourceJobManager = null;
        for (JobSubmissionInterface jobSubmissionInterface : computeResource.getJobSubmissionInterfaces()) {
            switch (jobSubmissionInterface.getJobSubmissionProtocol()) {
                case LOCAL:
                    legacyHostDescription = new HostDescription();
                    LOCALSubmission localSubmission =
                            appCatalog.getComputeResource().getLocalJobSubmission(jobSubmissionInterface.getJobSubmissionInterfaceId());
                    resourceJobManager = localSubmission.getResourceJobManager();
                    break;
                case SSH:
                    SSHJobSubmission sshJobSubmission =
                            appCatalog.getComputeResource().getSSHJobSubmission(jobSubmissionInterface.getJobSubmissionInterfaceId());
                    resourceJobManager = sshJobSubmission.getResourceJobManager();
                    switch (sshJobSubmission.getSecurityProtocol()) {
                        case GSI:
                            legacyHostDescription = new HostDescription(GsisshHostType.type);
                            ((GsisshHostType) legacyHostDescription.getType()).setJobManager
                                    (resourceJobManager.getResourceJobManagerType().name());
                            ((GsisshHostType) legacyHostDescription.getType()).setInstalledPath(resourceJobManager.getJobManagerBinPath());
                            // applicationDescription.setInstalledParentPath(resourceJobManager.getJobManagerBinPath());
                            ((GsisshHostType) legacyHostDescription.getType()).setPort(sshJobSubmission.getSshPort());
                            break;
                        case SSH_KEYS:
                            legacyHostDescription = new HostDescription(SSHHostType.type);
                            ((SSHHostType) legacyHostDescription.getType()).setHpcResource(true);
                            break;
                        default:
                            legacyHostDescription = new HostDescription(SSHHostType.type);
                            ((SSHHostType) legacyHostDescription.getType()).setHpcResource(true);
                            break;
                    }
                    break;
                default:
                    break;
            }
        }
        HostDescriptionType legacyHostDescType = legacyHostDescription.getType();
        legacyHostDescType.setHostName(computeResource.getHostName());
        String ipAddress = computeResource.getHostName();
        if (computeResource.getIpAddresses() != null && computeResource.getIpAddresses().size() > 0) {
            ipAddress = computeResource.getIpAddresses().iterator().next();
        } else if (computeResource.getHostAliases() != null && computeResource.getHostAliases().size() > 0) {
            ipAddress = computeResource.getHostAliases().iterator().next();
        }
        legacyHostDescType.setHostAddress(ipAddress);

        /////////////////////---------------- APPLICATION DESCRIPTOR ---------------------/////////////////////////
        //Fetch deployment information and fill-in legacy doc
        if ((legacyHostDescType instanceof GsisshHostType) || (legacyHostDescType instanceof SSHHostType)) {
            legacyAppDescription = new ApplicationDescription(HpcApplicationDeploymentType.type);
            HpcApplicationDeploymentType legacyHPCAppDescType = (HpcApplicationDeploymentType) legacyAppDescription.getType();
            switch (applicationDeployment.getParallelism()) {
                case SERIAL:
                    legacyHPCAppDescType.setJobType(JobTypeType.SERIAL);
                    break;
                case MPI:
                    legacyHPCAppDescType.setJobType(JobTypeType.MPI);
                    break;
                case OPENMP:
                    legacyHPCAppDescType.setJobType(JobTypeType.OPEN_MP);
                    break;
                default:
                    break;
            }
            //Fetch scheduling information from experiment request
            ComputationalResourceScheduling taskSchedule = taskData.getTaskScheduling();
            QueueType queueType = legacyHPCAppDescType.addNewQueue();
            queueType.setQueueName(taskSchedule.getQueueName());
            legacyHPCAppDescType.setCpuCount(taskSchedule.getTotalCPUCount());
            legacyHPCAppDescType.setNodeCount(taskSchedule.getNodeCount());
            legacyHPCAppDescType.setMaxWallTime(taskSchedule.getWallTimeLimit());
            if (resourceJobManager != null) {
                legacyHPCAppDescType.setInstalledParentPath(resourceJobManager.getJobManagerBinPath());
                if (resourceJobManager.getJobManagerCommands() != null) {
                    legacyHPCAppDescType.setJobSubmitterCommand(resourceJobManager.getJobManagerCommands().get(JobManagerCommand.SUBMISSION));
                }
            }
            ProjectAccountType projectAccountType = legacyHPCAppDescType.addNewProjectAccount();
            if (gatewayResourcePreferences != null) {
                projectAccountType.setProjectAccountNumber(gatewayResourcePreferences.getAllocationProjectNumber());
            }
        } else {
            legacyAppDescription = new ApplicationDescription();
        }
        ApplicationDeploymentDescriptionType legacyAppDescType = legacyAppDescription.getType();
        legacyAppDescType.addNewApplicationName().setStringValue(applicationInterface.getApplicationName().replaceAll(" ", "_"));
        legacyAppDescType.setExecutableLocation(applicationDeployment.getExecutablePath());
        if (gatewayResourcePreferences != null) {
            legacyAppDescType.setScratchWorkingDirectory(gatewayResourcePreferences.getScratchLocation());
        } else {
            legacyAppDescType.setScratchWorkingDirectory("/tmp");
            log.warn("Missing gateway resource profile for gateway id '" + gatewayID + "'.");
        }
View Full Code Here

  public static ComputeResourcePreference createComputeResourcePreference(String computeResourceId, String scratchLocation,
      String allocationProjectNumber, boolean overridebyAiravata,
      String preferredBatchQueue, String preferredJobSubmissionProtocol,
      String preferredDataMovementProtocol) throws AppCatalogException {
    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;
  }
View Full Code Here

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

TOP

Related Classes of org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference$ComputeResourcePreferenceTupleScheme

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.