Examples of ApplicationDescriptionType


Examples of org.ogce.schemas.gfac.documents.ApplicationDescriptionType

        // host name
        String hostName = findHostFromServiceMap(registryService, appName);

        // app
        String appDesc = registryService.getAppDesc(appName.toString(), hostName);
        ApplicationDescriptionType appDescType = ApplicationDescriptionDocument.Factory.parse(appDesc).getApplicationDescription();

        // host desc
        String hostDesc = registryService.getHostDesc(hostName);
        HostDescriptionType hostDescType = HostDescriptionDocument.Factory.parse(hostDesc).getHostDescription();

        // application deployment
        DeploymentDescriptionType deploymentDesc = appDescType.getDeploymentDescription();
        String tmpDir = deploymentDesc.getTmpDir();
        if (tmpDir == null && hostDescType != null) {
          tmpDir = hostDescType.getHostConfiguration().getTmpDir();
        }

        if (tmpDir == null) {
          tmpDir = "/tmp";
        }

        String date = new Date().toString();
        date = date.replaceAll(" ", "_");
        date = date.replaceAll(":", "_");

        tmpDir = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + "_" + date + "_" + UUID.randomUUID();

        String workingDir = deploymentDesc.getWorkDir();
        if (workingDir == null || workingDir.trim().length() == 0) {
          workingDir = tmpDir;
        }

        String stdOut = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + ".stdout";
        String stderr = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + ".stderr";
        String executable = deploymentDesc.getExecutable();
        String host = deploymentDesc.getHostName();

        NameValuePairType[] env = deploymentDesc.getApplicationEnvArray();
        Map<String, String> envMap = new HashMap<String, String>();
View Full Code Here

Examples of org.ogce.schemas.gfac.documents.ApplicationDescriptionType

    }
  }

  public static ApplicationDescriptionType parseAppDescirption(Reader reader) throws GfacException {
    try {
      ApplicationDescriptionType appDesc = ApplicationDescriptionDocument.Factory.parse(reader).getApplicationDescription();
      SchemaValidator validator = new SchemaValidator(appDesc);
      validator.validate();
      return appDesc;
    } catch (IOException e) {
      throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
View Full Code Here

Examples of org.ogce.schemas.gfac.documents.ApplicationDescriptionType

    jobAttr.addEnvVariable(GFacConstants.INPUT_DATA_DIR, appExecContext.getExecutionModel().getInputDataDir());
        String outputDataDir = GFacConstants.OUTPUT_DATA_DIR;
        if(!outputDataDir.isEmpty()){
    jobAttr.addEnvVariable(outputDataDir, appExecContext.getExecutionModel().getOutputDataDir());
        }
    ApplicationDescriptionType app = appExecContext.getExecutionModel().getAplicationDesc();
    WorkflowContextHeader contextHeader = appExecContext.getWorkflowHeader();
    ResourceMapping resourceMapping = null;
    if (contextHeader != null) {
      resourceMapping = contextHeader.getResourceMappings().getResourceMappingArray(0);
    }

    log.info("Configure using App Desc = " + app.xmlText());
    if (resourceMapping != null && resourceMapping.getMaxWallTime() > 0) {
      log.info("Header Setting Max Wall Time" + resourceMapping.getMaxWallTime());
      jobAttr.setMaxWallTime(resourceMapping.getMaxWallTime());

    } else if (app.getMaxWallTime() > 0) {
      log.info("Setting max wall clock time to " + app.getMaxWallTime());

      if (app.getMaxWallTime() > 30 && app.getQueue() != null && app.getQueue().equals("debug")) {
        throw new GfacException("NCSA debug Queue only support jobs < 30 minutes", FaultCode.InvalidConfig);
      }

      jobAttr.setMaxWallTime(app.getMaxWallTime());
      jobAttr.set("proxy_timeout", "1");
    } else {
      jobAttr.setMaxWallTime(29);
    }

    if (appExecContext.getExecutionModel().getStdIn() != null) {
      jobAttr.setStdin(appExecContext.getExecutionModel().getStdIn());
    } else {
      Iterator<String> values = appExecContext.getExecutionModel().getInputParameters().iterator();
      while (values.hasNext()) {
        jobAttr.addArgument(values.next());
      }
    }
   
    if (resourceMapping != null && resourceMapping.getNodeCount() > 0) {
      log.info("Setting number of procs to " + resourceMapping.getNodeCount());
      jobAttr.set("hostCount", String.valueOf(resourceMapping.getNodeCount()));
    }else if (app.getHostCount() > 1) {
      jobAttr.set("hostCount", String.valueOf(app.getHostCount()));
    }
    if (resourceMapping != null && resourceMapping.getCpuCount() > 0) {
      log.info("Setting host count to " + resourceMapping.getCpuCount());
      jobAttr.setNumProcs(resourceMapping.getCpuCount());
     
    } else if (app.getCount() > 1) {
      log.info("Setting number of procs to " + app.getCount());
      jobAttr.setNumProcs(app.getCount());
    }

    if (app.getProject() != null && app.getProject().getProjectName() != null) {
      log.info("Setting project to " + app.getProject());
      jobAttr.setProject(app.getProject().getProjectName());
    }

    if (resourceMapping != null && resourceMapping.getQueueName() != null) {
      jobAttr.setQueue(resourceMapping.getQueueName());
    } else if (app.getQueue() != null && app.getQueue().getQueueName() != null) {
      log.info("Setting job queue to " + app.getQueue());
      jobAttr.setQueue(app.getQueue().getQueueName());
    }
    String jobType = JobType.SINGLE.toString() ;

    if (app.getJobType() != null) {
      jobType = app.getJobType().toString();
    }
    if (jobType.equalsIgnoreCase(JobType.SINGLE.toString())) {
      log.info("Setting job type to single");
      jobAttr.setJobType(GramAttributes.JOBTYPE_SINGLE);
    } else if (jobType.equalsIgnoreCase(JobType.MPI.toString())) {
      log.info("Setting job type to mpi");
      jobAttr.setJobType(GramAttributes.JOBTYPE_MPI);
    } else if (jobType.equalsIgnoreCase(JobType.MULTIPLE.toString())) {
      log.info("Setting job type to multiple");
      jobAttr.setJobType(GramAttributes.JOBTYPE_MULTIPLE);
    } else if (jobType.equalsIgnoreCase(JobType.CONDOR.toString())) {
      jobAttr.setJobType(GramAttributes.JOBTYPE_CONDOR);
    }

    // Support to add the Additional RSL parameters
    RSLParmType[] rslParams = app.getRslparmArray();
    if (rslParams.length > 0) {
      for (RSLParmType rslType : rslParams) {
        log.info("Adding rsl param of [" + rslType.getName() + "," + rslType.getStringValue() + "]");
        if (rslType.getName() != "") {
          jobAttr.set(rslType.getName(), rslType.getStringValue());
View Full Code Here

Examples of org.ogce.schemas.gfac.documents.ApplicationDescriptionType

    }

    public static ApplicationDescriptionType parseAppDescirption(Reader reader)
            throws GfacException {
        try {
            ApplicationDescriptionType appDesc = ApplicationDescriptionDocument.Factory.parse(
                    reader).getApplicationDescription();
            SchemaValidator validator = new SchemaValidator(appDesc);
            validator.validate();
            return appDesc;
        } catch (XmlException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.