Package org.apache.airavata.model.appcatalog.appdeployment

Examples of org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription


        application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.mdcrd", null, DataType.URI));
        application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.out", null, DataType.URI));
        application.addToApplicationOutputs(DocumentCreatorUtils.createAppOutput("AMBER_Prod.rst", null, DataType.URI));
        application.setApplicationInterfaceId(client.registerApplicationInterface(application));

        ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), amodule.getAppModuleId(), "/home/ogce/production/app_wrappers/amber_wrapper.sh", ApplicationParallelismType.SERIAL, "AmberStampede");
        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


    public static ApplicationDeploymentDescription createAppDeployment (String moduleId,
                                                                        String computeHost,
                                                                        String executablePath,
                                                                        String appDepDescription,
                                                                        String moduleLoadCmd){
        ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
        description.setAppModuleId(moduleId);
        description.setComputeHostId(computeHost);
        description.setExecutablePath(executablePath);
        description.setAppDeploymentDescription(appDepDescription);
        //TODO
//        description.setModuleLoadCmd(moduleLoadCmd);
        return description;
    }
View Full Code Here

        ApplicationModule module = new ApplicationModule();
        module.setAppModuleName("WRF");
        module.setAppModuleVersion("1.0.0");
        String wrfModuleId = appInt.addApplicationModule(module);

        ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
        description.setAppModuleId(wrfModuleId);
        description.setComputeHostId(hostId);
        description.setExecutablePath("/home/a/b/c");
        description.setAppDeploymentDescription("test app deployment");
        description.addToModuleLoadCmds("cmd1");
        description.addToModuleLoadCmds("cmd2");

        List<SetEnvPaths> libPrepandPaths = new ArrayList<SetEnvPaths>();
        libPrepandPaths.add(createSetEnvPath("name1", "val1"));
        libPrepandPaths.add(createSetEnvPath("name2", "val2"));
        description.setLibPrependPaths(libPrepandPaths);
        List<SetEnvPaths> libApendPaths = new ArrayList<SetEnvPaths>();
        libApendPaths.add(createSetEnvPath("name3", "val3"));
        libApendPaths.add(createSetEnvPath("name4", "val4"));
        description.setLibAppendPaths(libApendPaths);
        List<SetEnvPaths> appEvns = new ArrayList<SetEnvPaths>();
        appEvns.add(createSetEnvPath("name5", "val5"));
        appEvns.add(createSetEnvPath("name6", "val6"));
        description.setSetEnvironment(appEvns);

        String appDepId = appDep.addApplicationDeployment(description);
        ApplicationDeploymentDescription app = null;
        if (appDep.isAppDeploymentExists(appDepId)){
            app = appDep.getApplicationDeployement(appDepId);
            System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription());
        }

        description.setAppDeploymentDescription("test app deployment2");
        appDep.updateApplicationDeployment(appDepId, description);

        if (appDep.isAppDeploymentExists(appDepId)){
            app = appDep.getApplicationDeployement(appDepId);
            System.out.println("*********** application deployment desc ********* : " + app.getAppDeploymentDescription());
        }

        Map<String, String> moduleIdFilter = new HashMap<String, String>();
        moduleIdFilter.put(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID, wrfModuleId);
        List<ApplicationDeploymentDescription> applicationDeployements = appDep.getApplicationDeployements(moduleIdFilter);
View Full Code Here

        outputDataObjectType.setType(DataType.valueOf(output.getDataType()));
        return outputDataObjectType;
    }

    public static ApplicationDeploymentDescription getApplicationDeploymentDescription (AppDeploymentResource resource) throws AppCatalogException {
        ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
        description.setAppDeploymentId(resource.getDeploymentId());
        description.setAppModuleId(resource.getAppModuleId());
        description.setComputeHostId(resource.getHostId());
        description.setExecutablePath(resource.getExecutablePath());
        if (resource.getParallelism() != null){
            description.setParallelism(ApplicationParallelismType.valueOf(resource.getParallelism()));
        }
        description.setAppDeploymentDescription(resource.getAppDes());
        ModuleLoadCmdResource cmdResource = new ModuleLoadCmdResource();
        List<Resource> moduleLoadCmds = cmdResource.get(AbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, resource.getDeploymentId());
        if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
            for (Resource moduleLoadCmd : moduleLoadCmds){
                description.addToModuleLoadCmds(((ModuleLoadCmdResource) moduleLoadCmd).getCmd());
            }
        }
        LibraryPrepandPathResource prepandPathResource = new LibraryPrepandPathResource();
        List<Resource> libPrepandPaths = prepandPathResource.get(AbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
        if (libPrepandPaths != null && !libPrepandPaths.isEmpty()){
            description.setLibPrependPaths(getLibPrepandPaths(libPrepandPaths));
        }

        LibraryApendPathResource apendPathResource = new LibraryApendPathResource();
        List<Resource> libApendPaths = apendPathResource.get(AbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
        if (libApendPaths != null && !libApendPaths.isEmpty()){
            description.setLibAppendPaths(getLibApendPaths(libApendPaths));
        }

        AppEnvironmentResource appEnvironmentResource = new AppEnvironmentResource();
        List<Resource> appEnvList = appEnvironmentResource.get(AbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, resource.getDeploymentId());
        if (appEnvList != null && !appEnvList.isEmpty()){
            description.setSetEnvironment(getAppEnvPaths(appEnvList));
        }
        return description;
    }
View Full Code Here

      if (applicationId == null) {
        throw new OrchestratorException(
            "Error executing the job because there is no Application Name in this Experiment:  "
                + applicationId);
      }
      ApplicationDeploymentDescription applicationDeploymentDescription = getAppDeployment(taskData, applicationId);
            taskData.setApplicationDeploymentId(applicationDeploymentDescription.getAppDeploymentId());
      registry.update(RegistryModelType.TASK_DETAIL, taskData,taskData.getTaskID());
      List<Object> workflowNodeDetailList = registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL,
              org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants.TASK_LIST, taskData);
      if (workflowNodeDetailList != null
          && workflowNodeDetailList.size() > 0) {
View Full Code Here

      throws AppCatalogException, OrchestratorException,
      ClassNotFoundException, ApplicationSettingsException,
      InstantiationException, IllegalAccessException {
    AppCatalog appCatalog = AppCatalogFactory.getAppCatalog();
    String selectedModuleId = getModuleId(appCatalog, applicationId);
    ApplicationDeploymentDescription applicationDeploymentDescription = getAppDeployment(
        appCatalog, taskData, selectedModuleId);
    return applicationDeploymentDescription;
  }
View Full Code Here

    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

    }

    public static ApplicationDeploymentDescription createApplicationDeployment(
           String appModuleId, String computeResourceId, String executablePath,
           ApplicationParallelismType parallelism, String appDeploymentDescription) {
        ApplicationDeploymentDescription deployment = new ApplicationDeploymentDescription();
//    deployment.setIsEmpty(false);
        deployment.setAppDeploymentDescription(appDeploymentDescription);
        deployment.setAppModuleId(appModuleId);
        deployment.setComputeHostId(computeResourceId);
        deployment.setExecutablePath(executablePath);
        deployment.setParallelism(parallelism);
        return deployment;
    }
View Full Code Here

        AppCatalog appCatalog = AppCatalogFactory.getAppCatalog();

        //fetch the compute resource, application interface and deployment information from app catalog
        ApplicationInterfaceDescription applicationInterface = appCatalog.
                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 ApplicationDeploymentDescription createApplicationDeployment(
      String computeResourceId, String appModuleId,
      String executablePath, ApplicationParallelismType parallelism, String appDeploymentDescription) {
    ApplicationDeploymentDescription deployment = new ApplicationDeploymentDescription();
//    deployment.setIsEmpty(false);
    deployment.setAppDeploymentDescription(appDeploymentDescription);
    deployment.setAppModuleId(appModuleId);
    deployment.setComputeHostId(computeResourceId);
    deployment.setExecutablePath(executablePath);
    deployment.setParallelism(parallelism);
    return deployment;
  }
View Full Code Here

TOP

Related Classes of org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription

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.