Examples of ApplicationDeploymentDescriptionType


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

          //TODO
        }


        ApplicationDescription applicationDeploymentDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
        ApplicationDeploymentDescriptionType app = applicationDeploymentDescription.getType();
        GridFtp ftp = new GridFtp();

        try {
            GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getGssCredentails();

            if (gridFTPEndpointArray == null || gridFTPEndpointArray.length == 0) {
              gridFTPEndpointArray = new String[]{hostType.getHostAddress()};
            }
            boolean success = false;
            GFacHandlerException pe = null;// = new ProviderException("");
            for (String endpoint : gridFTPEndpointArray) {
                try {

                    URI tmpdirURI = GFacUtils.createGsiftpURI(endpoint, app.getScratchWorkingDirectory());
                    URI workingDirURI = GFacUtils.createGsiftpURI(endpoint, app.getStaticWorkingDirectory());
                    URI inputURI = GFacUtils.createGsiftpURI(endpoint, app.getInputDataDirectory());
                    URI outputURI = GFacUtils.createGsiftpURI(endpoint, app.getOutputDataDirectory());

                    log.info("Host FTP = " + gridFTPEndpointArray[0]);
                    log.info("temp directory = " + tmpdirURI);
                    log.info("Working directory = " + workingDirURI);
                    log.info("Input directory = " + inputURI);
View Full Code Here

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

    makeDirectory(jobExecutionContext);

  }
  private void makeDirectory(JobExecutionContext context) throws GFacHandlerException,GFacException {
    SSHSecurityContext securityContext = (SSHSecurityContext)context.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT);
    ApplicationDeploymentDescriptionType app = context.getApplicationContext().getApplicationDeploymentDescription().getType();
    Session session = null;
    try {
      session = securityContext.getSession(context.getApplicationContext().getHostDescription().getType().getHostAddress());

      StringBuilder commandString = new StringBuilder();

      commandString.append("mkdir -p ");
      commandString.append(app.getScratchWorkingDirectory());
      commandString.append(" ; ");
      commandString.append("mkdir -p ");
      commandString.append(app.getStaticWorkingDirectory());
      commandString.append(" ; ");
      commandString.append("mkdir -p ");
      commandString.append(app.getInputDataDirectory());
      commandString.append(" ; ");
      commandString.append("mkdir -p ");
      commandString.append(app.getOutputDataDirectory());

      Command cmd = session.exec(commandString.toString());
      cmd.join(Constants.COMMAND_EXECUTION_TIMEOUT, TimeUnit.SECONDS);
    } catch (ConnectionException e) {
      throw new GFacHandlerException(e.getMessage(), e, context);
View Full Code Here

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

              throw new GFacHandlerException("Error while input File Staging", jobExecutionContext, e, e.getLocalizedMessage());
          }
          jobExecutionContext.setInMessageContext(inputNew);
  }
   private static String stageInputFiles(JobExecutionContext context,String paramValue) throws IOException,GFacException{
     ApplicationDeploymentDescriptionType app = context.getApplicationContext().getApplicationDeploymentDescription().getType();

     SSHSecurityContext securityContext = (SSHSecurityContext)context.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT);
     SCPFileTransfer fileTransfer = securityContext.getSSHClient().newSCPFileTransfer();
     String remoteFile = app.getInputDataDirectory() + File.separatorChar + paramValue;

     File inputFile = new File(paramValue);
     fileTransfer.upload(inputFile.getAbsolutePath(), remoteFile);
     return remoteFile;
   }
View Full Code Here

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

        applicationContext.setHostDescription(host);
        /*
           * App
           */
        ApplicationDescription appDesc = new ApplicationDescription();
        ApplicationDeploymentDescriptionType app = appDesc.getType();
        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
        name.setStringValue("EchoLocal");
        app.setApplicationName(name);

        /*
           * Use bat file if it is compiled on Windows
           */
        if (SystemUtils.IS_OS_WINDOWS) {
            URL url = this.getClass().getClassLoader().getResource("echo.bat");
            app.setExecutableLocation(url.getFile());
        } else {
            //for unix and Mac
            app.setExecutableLocation("/bin/echo");
        }

        /*
           * Default tmp location
           */
        String tempDir = System.getProperty("java.io.tmpdir");
        if (tempDir == null) {
            tempDir = "/tmp";
        }

        app.setScratchWorkingDirectory(tempDir);
        app.setStaticWorkingDirectory(tempDir);
        app.setInputDataDirectory(tempDir + File.separator + "input");
        app.setOutputDataDirectory(tempDir + File.separator + "output");
        app.setStandardOutput(tempDir + File.separator + "echo.stdout");
        app.setStandardError(tempDir + File.separator + "echo.stderr");

        applicationContext.setApplicationDeploymentDescription(appDesc);

        /*
           * Service
 
View Full Code Here

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

        /*
        * App
        */
        ApplicationDescription appDesc =
                new ApplicationDescription(HpcApplicationDeploymentType.type);
        ApplicationDeploymentDescriptionType applicationDeploymentDescriptionType
                = appDesc.getType();
        applicationDeploymentDescriptionType.addNewApplicationName().setStringValue(serviceName);
        String tempDir = "/oasis/projects/nsf/uic151/gridchem/airavata-workdirs";
        String date = (new Date()).toString();
        date = date.replaceAll(" ", "_");
        date = date.replaceAll(":", "_");

        tempDir = tempDir + File.separator
                + serviceName + "_" + date + "_" + UUID.randomUUID();
        applicationDeploymentDescriptionType.setExecutableLocation("/home/gridchem/workflow_script/sys_exec/scripts/step1/step1_model_refdata_prep.sh");
        applicationDeploymentDescriptionType.setScratchWorkingDirectory(tempDir);
        applicationDeploymentDescriptionType.setStaticWorkingDirectory(tempDir);
        applicationDeploymentDescriptionType.setInputDataDirectory(tempDir + File.separator + "inputData");
        applicationDeploymentDescriptionType.setOutputDataDirectory(tempDir + File.separator + "outputData");
        applicationDeploymentDescriptionType.setStandardOutput(tempDir + File.separator + applicationDeploymentDescriptionType.getApplicationName().getStringValue() + ".stdout");
        applicationDeploymentDescriptionType.setStandardError(tempDir + File.separator + applicationDeploymentDescriptionType.getApplicationName().getStringValue() + ".stderr");

        ProjectAccountType projectAccountType = ((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).addNewProjectAccount();
        projectAccountType.setProjectAccountNumber("uic151");

        QueueType queueType = ((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).addNewQueue();
View Full Code Here

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

            handleOutPath(jobExecutionContext);
        }
    }

    private void handleInPath(JobExecutionContext jobExecutionContext) throws GFacHandlerException, IOException {
        ApplicationDeploymentDescriptionType appDepDesc =
                jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
        HadoopApplicationDeploymentDescriptionType hadoopAppDesc =
                (HadoopApplicationDeploymentDescriptionType)appDepDesc;
        if(appDepDesc.isSetInputDataDirectory() && isInputDataDirectoryLocal(appDepDesc)){
            Configuration hadoopConf = HadoopUtils.createHadoopConfiguration(jobExecutionContext, isWhirrBasedDeployment, hadoopConfigDir);
            FileSystem hdfs = FileSystem.get(hadoopConf);
            hdfs.copyFromLocalFile(new Path(appDepDesc.getInputDataDirectory()),
                    new Path(hadoopAppDesc.getHadoopJobConfiguration().getHdfsInputDirectory()));
        }
    }
View Full Code Here

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

public class SCPOutputHandler implements GFacHandler{

  @Override
  public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
    ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
    try {
       SSHSecurityContext securityContext = (SSHSecurityContext)jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT);

      // Get the Stdouts and StdErrs
      String timeStampedServiceName = GFacUtils.createUniqueNameForService(jobExecutionContext.getServiceName());
      File localStdOutFile = File.createTempFile(timeStampedServiceName, "stdout");
      File localStdErrFile = File.createTempFile(timeStampedServiceName, "stderr");

      SCPFileTransfer fileTransfer = securityContext.getSSHClient().newSCPFileTransfer();
      fileTransfer.download(app.getStandardOutput(), localStdOutFile.getAbsolutePath());
      fileTransfer.download(app.getStandardError(), localStdErrFile.getAbsolutePath());

      String stdOutStr = GFacUtils.readFileToString(localStdOutFile.getAbsolutePath());
      String stdErrStr = GFacUtils.readFileToString(localStdErrFile.getAbsolutePath());
       Map<String, ActualParameter> stringMap = new HashMap<String, ActualParameter>();
View Full Code Here

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

        else {
          //TODO
        }


        ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
        GridFtp ftp = new GridFtp();
        URI destURI = null;
        GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getGssCredentails();

        for (String endpoint : gridFTPEndpointArray) {
            URI inputURI = GFacUtils.createGsiftpURI(endpoint, app.getInputDataDirectory());
            String fileName = new File(gridftpURL.getPath()).getName();
            String s = inputURI.getPath() + File.separator + fileName;
            //if user give a url just to refer an endpoint, not a web resource we are not doing any transfer
            if (fileName != null && !"".equals(fileName)) {
                destURI = GFacUtils.createGsiftpURI(endpoint, s);
View Full Code Here

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

    public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
        log.info("Invoking GramDirectorySetupHandler ...");
        HostDescriptionType type = jobExecutionContext.getApplicationContext().getHostDescription().getType();
        ApplicationDescription applicationDeploymentDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
        ApplicationDeploymentDescriptionType app = applicationDeploymentDescription.getType();
        log.debug("working diectroy = " + app.getStaticWorkingDirectory());
        log.debug("temp directory = " + app.getScratchWorkingDirectory());

        makeFileSystemDir(app.getStaticWorkingDirectory(),jobExecutionContext);
        makeFileSystemDir(app.getScratchWorkingDirectory(),jobExecutionContext);
        makeFileSystemDir(app.getInputDataDirectory(),jobExecutionContext);
        makeFileSystemDir(app.getOutputDataDirectory(),jobExecutionContext);
    }
View Full Code Here

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

        applicationContext.setHostDescription(host);
        /*
           * App
           */
        ApplicationDescription appDesc = new ApplicationDescription();
        ApplicationDeploymentDescriptionType app = appDesc.getType();
        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
        name.setStringValue("EchoSSH");
        app.setApplicationName(name);

        /*
           * Use bat file if it is compiled on Windows
           */
        if (SystemUtils.IS_OS_WINDOWS) {
            URL url = this.getClass().getClassLoader().getResource("echo.bat");
            app.setExecutableLocation(url.getFile());
        } else {
            //for unix and Mac
            app.setExecutableLocation("/bin/echo");
        }

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

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

        app.setScratchWorkingDirectory(tempDir);
        app.setStaticWorkingDirectory(tempDir);
        app.setInputDataDirectory(tempDir + File.separator + "input");
        app.setOutputDataDirectory(tempDir + File.separator + "output");
        app.setStandardOutput(tempDir + File.separator + "echo.stdout");
        app.setStandardError(tempDir + File.separator + "echo.stderr");

        applicationContext.setApplicationDeploymentDescription(appDesc);

        /*
           * Service
 
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.