Package org.apache.airavata.schemas.gfac

Examples of org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType


    JobDefinitionDocument jobDefDoc = JobDefinitionDocument.Factory
        .newInstance();
    JobDefinitionType value = jobDefDoc.addNewJobDefinition();

    HpcApplicationDeploymentType appDepType = (HpcApplicationDeploymentType) context
        .getApplicationContext().getApplicationDeploymentDescription()
        .getType();

    // build Identification
    createJobIdentification(value, appDepType);
View Full Code Here


public class DataStagingProcessor {
 
  public static void generateDataStagingElements(JobDefinitionType value, JobExecutionContext context) throws Exception{
   
    HpcApplicationDeploymentType appDepType = (HpcApplicationDeploymentType) context
        .getApplicationContext().getApplicationDeploymentDescription()
        .getType();

   
    String gridftpEndpoint = ((UnicoreHostType) context.getApplicationContext().getHostDescription().getType())
View Full Code Here

        ((GlobusHostType)host.getType()).setGridFTPEndPointArray(new String[]{gridftpAddress});
        /*
           * App
           */
        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType)appDesc.getType();
        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
        name.setStringValue("EchoLocal");
        app.setApplicationName(name);
        ProjectAccountType projectAccountType = app.addNewProjectAccount();
        projectAccountType.setProjectAccountNumber("sds128");

        QueueType queueType = app.addNewQueue();
        queueType.setQueueName("development");

        app.setCpuCount(1);
        app.setJobType(JobTypeType.SERIAL);
        app.setNodeCount(1);
        app.setProcessorsPerNode(1);

        /*
           * Use bat file if it is compiled on Windows
           */
        app.setExecutableLocation("/bin/echo");

        /*
           * Default tmp location
           */
        String tempDir = "/scratch/01437/ogce/test/";
        String date = (new Date()).toString();
        date = date.replaceAll(" ", "_");
        date = date.replaceAll(":", "_");

        tempDir = tempDir + File.separator
                + "SimpleEcho" + "_" + date + "_" + UUID.randomUUID();

        System.out.println(tempDir);
        app.setScratchWorkingDirectory(tempDir);
        app.setStaticWorkingDirectory(tempDir);
        app.setInputDataDirectory(tempDir + File.separator + "inputData");
        app.setOutputDataDirectory(tempDir + File.separator + "outputData");
        app.setStandardOutput(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stdout");
        app.setStandardError(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stderr");


        /*
           * Service
           */
 
View Full Code Here

    String userName = getUserNameFromContext(context);
    if (userName.equalsIgnoreCase("admin")){
      userName = "CN=zdv575, O=Ultrascan Gateway, C=DE";
    }
   
    HpcApplicationDeploymentType appDepType = (HpcApplicationDeploymentType) context
        .getApplicationContext().getApplicationDeploymentDescription()
        .getType();
   
    createGenericApplication(value, appDepType);
   
    if (appDepType.getApplicationEnvironmentArray().length > 0) {
      createApplicationEnvironment(value,
          appDepType.getApplicationEnvironmentArray(), appDepType);
    }

   
    if (appDepType.getExecutableLocation() != null) {
      FileNameType fNameType = FileNameType.Factory.newInstance();
      fNameType.setStringValue(appDepType.getExecutableLocation());
      if(isParallelJob(appDepType)) {
        JSDLUtils.getOrCreateSPMDApplication(value).setExecutable(fNameType);
        JSDLUtils.getSPMDApplication(value).setSPMDVariation(getSPMDVariation(appDepType));
       
        if(getValueFromMap(appDepType, JSDLUtils.NUMBEROFPROCESSES)!=null){
          NumberOfProcessesType num = NumberOfProcessesType.Factory.newInstance();
          num.setStringValue(getValueFromMap(appDepType, JSDLUtils.NUMBEROFPROCESSES));
          JSDLUtils.getSPMDApplication(value).setNumberOfProcesses(num);
        }
             
        if(getValueFromMap(appDepType, JSDLUtils.PROCESSESPERHOST)!=null){
          ProcessesPerHostType pph = ProcessesPerHostType.Factory.newInstance();
          pph.setStringValue(getValueFromMap(appDepType, JSDLUtils.PROCESSESPERHOST));
          JSDLUtils.getSPMDApplication(value).setProcessesPerHost(pph);
        }
       
        if(getValueFromMap(appDepType, JSDLUtils.THREADSPERHOST)!=null){
          ThreadsPerProcessType tpp = ThreadsPerProcessType.Factory.newInstance();
          tpp.setStringValue(getValueFromMap(appDepType, JSDLUtils.THREADSPERHOST));
          JSDLUtils.getSPMDApplication(value).setThreadsPerProcess(tpp);
         
        }
       
        if(userName != null) {
          UserNameType userNameType = UserNameType.Factory.newInstance();
          userNameType.setStringValue(userName);
          JSDLUtils.getSPMDApplication(value).setUserName(userNameType);
        }
      }
      else {
        JSDLUtils.getOrCreatePOSIXApplication(value).setExecutable(fNameType);
        if(userName != null) {
          UserNameType userNameType = UserNameType.Factory.newInstance();
          userNameType.setStringValue(userName);
          JSDLUtils.getOrCreatePOSIXApplication(value).setUserName(userNameType);
        }
      }
    }
   

    String stdout = (appDepType.getStandardOutput() != null) ? new File(appDepType.getStandardOutput()).getName(): "stdout";
    ApplicationProcessor.setApplicationStdOut(value, appDepType, stdout);
   
 
    String stderr = (appDepType.getStandardError() != null) ? new File(appDepType.getStandardError()).getName() : "stderr";
    ApplicationProcessor.setApplicationStdErr(value, appDepType, stderr);
 
  }
View Full Code Here

public class ResourceProcessor {

 
  public static void generateResourceElements(JobDefinitionType value, JobExecutionContext context) throws Exception{
   
    HpcApplicationDeploymentType appDepType = (HpcApplicationDeploymentType) context
        .getApplicationContext().getApplicationDeploymentDescription()
        .getType();
   
    createMemory(value, appDepType);
    ContextHeaderDocument.ContextHeader currentContextHeader = context.getContextHeader();
      if(currentContextHeader != null){
        if (currentContextHeader.getWorkflowSchedulingContext() != null) {
            if (currentContextHeader != null &&
                    currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray() != null &&
                    currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray().length > 0) {
                try {
                    int cpuCount = currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray()[0].getCpuCount();
                    if(cpuCount>0){
//                      appDepType.setCpuCount(cpuCount);
                    NumberOfProcessesType num = NumberOfProcessesType.Factory.newInstance();
              String processers = Integer.toString(cpuCount);
            num.setStringValue(processers);
              JSDLUtils.getOrCreateSPMDApplication(value).setNumberOfProcesses(num);
                    }
                } catch (NullPointerException e) {
                    new GFacProviderException("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used",e);
                }
                try {
                    int nodeCount = currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray()[0].getNodeCount();
                    if(nodeCount>0){
                      appDepType.setNodeCount(nodeCount);
                    }
                } catch (NullPointerException e) {
                     new GFacProviderException("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used",e);
                }
                try {
                    String queueName = currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray()[0].getQueueName();
                    if (queueName != null) {
                        if(appDepType.getQueue() == null){
                            QueueType queueType = appDepType.addNewQueue();
                            queueType.setQueueName(queueName);
                        }else{
                          appDepType.getQueue().setQueueName(queueName);
                        }
                    }
                } catch (NullPointerException e) {
                     new GFacProviderException("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used",e);
                }
                try {
                    int maxwallTime = currentContextHeader.getWorkflowSchedulingContext().getApplicationSchedulingContextArray()[0].getMaxWallTime();
                    if(maxwallTime>0){
                      appDepType.setMaxWallTime(maxwallTime);
                    }
                } catch (NullPointerException e) {
                     new GFacProviderException("No Value sent in WorkflowContextHeader for Node Count, value in the Deployment Descriptor will be used",e);
                }
            }
        }
      }
   
    if (appDepType.getCpuCount() > 0) {
      RangeValueType rangeType = new RangeValueType();
      rangeType.setLowerBound(Double.NaN);
      rangeType.setUpperBound(Double.NaN);
      rangeType.setExact(appDepType.getCpuCount());
      JSDLUtils.setTotalCPUCountRequirements(value, rangeType);
    }

    if (appDepType.getProcessorsPerNode() > 0) {
      RangeValueType rangeType = new RangeValueType();
      rangeType.setLowerBound(Double.NaN);
      rangeType.setUpperBound(Double.NaN);
      rangeType.setExact(appDepType.getProcessorsPerNode());
      JSDLUtils.setIndividualCPUCountRequirements(value, rangeType);
    }
   
    if (appDepType.getNodeCount() > 0) {
      RangeValueType rangeType = new RangeValueType();
      rangeType.setLowerBound(Double.NaN);
      rangeType.setUpperBound(Double.NaN);
      rangeType.setExact(appDepType.getNodeCount());
      JSDLUtils.setTotalResourceCountRequirements(value, rangeType);
    }
   
    if(appDepType.getMaxWallTime() > 0) {
      RangeValueType cpuTime = new RangeValueType();
      cpuTime.setLowerBound(Double.NaN);
      cpuTime.setUpperBound(Double.NaN);
      long wallTime = appDepType.getMaxWallTime() * 60;
      cpuTime.setExact(wallTime);
      JSDLUtils.setIndividualCPUTimeRequirements(value, cpuTime);
    }
  }
View Full Code Here

    public static ApplicationDescription registerApplication(String appName, String exeuctableLocation, String scratchWorkingDirectory, String hostName,
                                                                       String projAccNumber, String queueName, String cpuCount, String nodeCount, String maxMemory) throws Exception {
        // Create Application Description
        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();
        app.setCpuCount(Integer.parseInt(cpuCount));
        app.setNodeCount(Integer.parseInt(nodeCount));
        ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
        name.setStringValue(appName);
        app.setExecutableLocation(exeuctableLocation);
        app.setScratchWorkingDirectory(scratchWorkingDirectory);
        ProjectAccountType projectAccountType = ((HpcApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
        projectAccountType.setProjectAccountNumber(projAccNumber);
        QueueType queueType = app.addNewQueue();
        queueType.setQueueName(queueName);
        app.setMaxMemory(Integer.parseInt(maxMemory));
        return appDesc;
    }
View Full Code Here

                        i++;
                    }
                    appDesc.getType().setApplicationEnvironmentArray(appEnviVariablesArray);
                }

                HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc.getType();

                ProjectAccountType projectAccountType = app.addNewProjectAccount();
                if (applicationDescriptor.getProjectNumber() != null){
                    projectAccountType.setProjectAccountNumber(applicationDescriptor.getProjectNumber());
                }
                if (applicationDescriptor.getProjectDescription() != null){
                    projectAccountType.setProjectAccountDescription(applicationDescriptor.getProjectDescription());
                }
                app.setProjectAccount(projectAccountType);

                app.setCpuCount(applicationDescriptor.getCpuCount());
                if (applicationDescriptor.getJobType() != null){
                    app.setJobType(JobTypeType.Enum.forString(applicationDescriptor.getJobType()));
                }
                app.setInstalledParentPath(applicationDescriptor.getInstalledPath());
                app.setJobSubmitterCommand(applicationDescriptor.getJobSubmitterCommand());
                app.setMaxMemory(applicationDescriptor.getMaxMemory());
                app.setMinMemory(applicationDescriptor.getMinMemory());
                app.setMaxWallTime(applicationDescriptor.getMaxWallTime());
                app.setNodeCount(applicationDescriptor.getNodeCount());
                app.setProcessorsPerNode(applicationDescriptor.getProcessorsPerNode());

                QueueType queueType = app.addNewQueue();
                if (applicationDescriptor.getQueueName() != null){
                    queueType.setQueueName(applicationDescriptor.getQueueName());
                }
                app.setQueue(queueType);

                return appDesc;
            }
        }
        return applicationDescription;
View Full Code Here

        }

        if(applicationDescription.getType() != null){
            if(applicationDescription.getType() instanceof HpcApplicationDeploymentType){
                applicationDescriptor.setApplicationDescType(ApplicationDescriptorTypes.HPC_APP_DEP_DESC_TYPE);
                HpcApplicationDeploymentType gramApplicationDeploymentType = (HpcApplicationDeploymentType) applicationDescription.getType();
                if(gramApplicationDeploymentType != null){
                    applicationDescriptor.setCpuCount(gramApplicationDeploymentType.getCpuCount());
                    applicationDescriptor.setNodeCount(gramApplicationDeploymentType.getNodeCount());
                    applicationDescriptor.setMaxMemory(gramApplicationDeploymentType.getMaxMemory());
                    applicationDescriptor.setMinMemory(gramApplicationDeploymentType.getMinMemory());
                    applicationDescriptor.setMaxWallTime(gramApplicationDeploymentType.getMaxWallTime());
                    applicationDescriptor.setJobSubmitterCommand(gramApplicationDeploymentType.getJobSubmitterCommand());
                    applicationDescriptor.setInstalledPath(gramApplicationDeploymentType.getInstalledParentPath());
                    if (gramApplicationDeploymentType.getJobType() != null)  {
                        applicationDescriptor.setJobType(gramApplicationDeploymentType.getJobType().toString());
                    }
                    if (gramApplicationDeploymentType.getProjectAccount() != null){
                        if (gramApplicationDeploymentType.getProjectAccount().getProjectAccountNumber() != null){
                            applicationDescriptor.setProjectNumber(gramApplicationDeploymentType.getProjectAccount().getProjectAccountNumber());
                        }
                    }
                    if (gramApplicationDeploymentType.getProjectAccount() != null){
                        if (gramApplicationDeploymentType.getProjectAccount().getProjectAccountDescription() != null){
                            applicationDescriptor.setProjectDescription(gramApplicationDeploymentType.getProjectAccount().getProjectAccountDescription());
                        }
                    }
                    if(gramApplicationDeploymentType.getQueue() != null){
                        applicationDescriptor.setQueueName(gramApplicationDeploymentType.getQueue().getQueueName());
                    }
                    applicationDescriptor.setProcessorsPerNode(gramApplicationDeploymentType.getProcessorsPerNode());
                }
            } else if (applicationDescription.getType() instanceof Ec2ApplicationDeploymentType) {
                applicationDescriptor.setApplicationDescType(ApplicationDescriptorTypes.EC2_APP_DEP_DESC_TYPE);
            }
        }
View Full Code Here

    File file = new File(downloadLocation);
    if(!file.exists()){
      file.mkdirs()
    }
   
    HpcApplicationDeploymentType appDepType = (HpcApplicationDeploymentType) jobContext
        .getApplicationContext().getApplicationDeploymentDescription()
        .getType();
   
    String stdout = appDepType.getStandardOutput();
    String stderr = appDepType.getStandardError();
    if(stdout != null) {
      stdout = stdout.substring(stdout.lastIndexOf('/')+1);
    }
   
    if(stderr != null) {
View Full Code Here

  }

  protected ApplicationDescription getApplicationDesc(JobTypeType jobType, boolean setOuput) {
    ApplicationDescription appDesc = new ApplicationDescription(
        HpcApplicationDeploymentType.type);
    HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) appDesc
        .getType();
    ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory
        .newInstance();
    name.setStringValue("EchoLocal");
    app.setApplicationName(name);
    ProjectAccountType projectAccountType = app.addNewProjectAccount();
    projectAccountType.setProjectAccountNumber("TG-AST110064");

    QueueType queueType = app.addNewQueue();
    queueType.setQueueName("development");

    app.setCpuCount(1);
    // TODO: also handle parallel jobs
    if((jobType.enumValue() == JobTypeType.SERIAL) || (jobType.enumValue() == JobTypeType.SINGLE)) {
      app.setJobType(JobTypeType.SERIAL);
    }
    else if (jobType.enumValue() == JobTypeType.MPI) {
      app.setJobType(JobTypeType.MPI);
    }
    else {
      app.setJobType(JobTypeType.OPEN_MP);
    }
   
    app.setNodeCount(1);
    app.setProcessorsPerNode(1);

    /*
     * Use bat file if it is compiled on Windows
     */
    app.setExecutableLocation("/bin/cat");

    /*
     * Default tmp location
     */
    String date = (new Date()).toString();
    date = date.replaceAll(" ", "_");
    date = date.replaceAll(":", "_");

    String remoteTempDir = scratchDir + File.separator + "SimpleEcho" + "_" + date + "_"
        + UUID.randomUUID();

    System.out.println(remoteTempDir);
   
    // no need of these parameters, as unicore manages by itself
    app.setScratchWorkingDirectory(remoteTempDir);
    app.setStaticWorkingDirectory(remoteTempDir);
    app.setInputDataDirectory(remoteTempDir + File.separator + "inputData");
    app.setOutputDataDirectory(remoteTempDir + File.separator + "outputData");
   
    if(setOuput) {   
      app.setStandardOutput(app.getOutputDataDirectory()+"/jsdl_stdout");
      app.setStandardError(app.getOutputDataDirectory()+"/jsdl_stderr");
    }
    return appDesc;
  }
View Full Code Here

TOP

Related Classes of org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType

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.