Examples of ApplicationDeploymentDescriptionType


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

            throw new GFacProviderException("Cannot make directory " + dir, jobExecutionContext);
        }
    }

    public void makeDirectory(JobExecutionContext jobExecutionContext) throws GFacProviderException {
        ApplicationDeploymentDescriptionType app = jobExecutionContext.
                getApplicationContext().getApplicationDeploymentDescription().getType();
        log.info("working diectroy = " + app.getStaticWorkingDirectory());
        log.info("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

    private static final Logger logger = LoggerFactory.getLogger(AppDescriptorCheckHandler.class);

    public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
        logger.info("Invoking ApplicationDescriptorCheckHandler ...");
        ApplicationDescription app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
        ApplicationDeploymentDescriptionType appDesc = app.getType();
        if (appDesc.getScratchWorkingDirectory() == null) {
            appDesc.setScratchWorkingDirectory("/tmp");
        }

        /*
        * Working dir
        */
        if (appDesc.getStaticWorkingDirectory() == null || "null".equals(appDesc.getStaticWorkingDirectory())) {
            String date = new Date().toString();
            date = date.replaceAll(" ", "_");
            date = date.replaceAll(":", "_");

            String tmpDir = appDesc.getScratchWorkingDirectory() + File.separator
                    + jobExecutionContext.getServiceName() + "_" + date + "_" + UUID.randomUUID();

            appDesc.setStaticWorkingDirectory(tmpDir);
        }

        /*
        * Input and Output Directory
        */
        if (appDesc.getInputDataDirectory() == null || "".equals(appDesc.getInputDataDirectory())) {
            appDesc.setInputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + "inputData");
        }
        if (appDesc.getOutputDataDirectory() == null || "".equals(appDesc.getOutputDataDirectory())) {
            appDesc.setOutputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + "outputData");
        }

        /*
        * Stdout and Stderr for Shell
        */
        if (appDesc.getStandardOutput() == null || "".equals(appDesc.getStandardOutput())) {
            appDesc.setStandardOutput(appDesc.getStaticWorkingDirectory() + File.separator
                    + appDesc.getApplicationName().getStringValue() + ".stdout");
        }
        if (appDesc.getStandardError() == null || "".equals(appDesc.getStandardError())) {
            appDesc.setStandardError(appDesc.getStaticWorkingDirectory() + File.separator
                    + appDesc.getApplicationName().getStringValue() + ".stderr");
        }
        jobExecutionContext.getApplicationContext().setApplicationDeploymentDescription(app);
    }
View Full Code Here

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

      public void actionPerformed(ActionEvent e) {
        HostDeploymentDialog hostDeploymentDialog = new HostDeploymentDialog(getRegistry(),true,null,null,Arrays.asList(getDeployments().keySet().toArray(new String[]{})));
        try {
          HostDeployment deployDesc = hostDeploymentDialog.execute();
          if (deployDesc!=null){
            ApplicationDeploymentDescriptionType appType = deployDesc.getApplicationDescription().getType();
            if (appType.getApplicationName()==null){
              appType.addNewApplicationName();
              }
            HostDescriptionType hostType = deployDesc.getHostDescription().getType();
            appType.getApplicationName().setStringValue(hostType.getHostName()+"_application");
            getDeployments().put(hostType.getHostName(), deployDesc);
            updateDeploymentTable();
          }
        } catch (AiravataAPIInvocationException e1) {
          setError(e1.getLocalizedMessage());
View Full Code Here

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

    public LocalProvider(){
        cmdList = new ArrayList<String>();
    }

    public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException {
        ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().
                getApplicationDeploymentDescription().getType();

        buildCommand(app.getExecutableLocation(), ProviderUtils.getInputParameters(jobExecutionContext));
        initProcessBuilder(app);

        // extra environment variables
        builder.environment().put(Constants.INPUT_DATA_DIR_VAR_NAME, app.getInputDataDirectory());
        builder.environment().put(Constants.OUTPUT_DATA_DIR_VAR_NAME, app.getOutputDataDirectory());

        // set working directory
        builder.directory(new File(app.getStaticWorkingDirectory()));

        // log info
        log.info("Command = " + InputUtils.buildCommand(cmdList));
        log.info("Working dir = " + builder.directory());
        for (String key : builder.environment().keySet()) {
View Full Code Here

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

        }
    }

    public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException {
        jobExecutionContext.getNotifier().publish(new StartExecutionEvent());
         ApplicationDeploymentDescriptionType app = jobExecutionContext.
                 getApplicationContext().getApplicationDeploymentDescription().getType();

        try {
            // running cmd
            Process process = builder.start();

            Thread standardOutWriter = new InputStreamToFileWriter(process.getInputStream(), app.getStandardOutput());
            Thread standardErrorWriter = new InputStreamToFileWriter(process.getErrorStream(), app.getStandardError());

            // start output threads
            standardOutWriter.setDaemon(true);
            standardErrorWriter.setDaemon(true);
            standardOutWriter.start();
            standardErrorWriter.start();

            // wait for the process (application) to finish executing
            int returnValue = process.waitFor();

            // make sure other two threads are done
            standardOutWriter.join();
            standardErrorWriter.join();

            /*
             * check return value. usually not very helpful to draw conclusions based on return values so don't bother.
             * just provide warning in the log messages
             */
            if (returnValue != 0) {
                log.error("Process finished with non zero return value. Process may have failed");
            } else {
                log.info("Process finished with return value of zero.");
            }

            StringBuffer buf = new StringBuffer();
            buf.append("Executed ").append(InputUtils.buildCommand(cmdList))
                    .append(" on the localHost, working directory = ").append(app.getStaticWorkingDirectory())
                    .append(" tempDirectory = ").append(app.getScratchWorkingDirectory()).append(" With the status ")
                    .append(String.valueOf(returnValue));

            log.info(buf.toString());

        } catch (IOException io) {
View Full Code Here

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

            throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
        }
    }

    public void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException {
        ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();

        try {
            String stdOutStr = GFacUtils.readFileToString(app.getStandardOutput());
            String stdErrStr = GFacUtils.readFileToString(app.getStandardError());
            OutputUtils.fillOutputFromStdout(jobExecutionContext, stdOutStr, stdErrStr);
        } catch (XmlException e) {
            throw new GFacProviderException("Cannot read output:" + e.getMessage(), e, jobExecutionContext);
        } catch (IOException io) {
            throw new GFacProviderException(io.getMessage(), io, jobExecutionContext);
View Full Code Here

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

    }

    public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException{
        jobExecutionContext.getNotifier().publish(new StartExecutionEvent());
        GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
        ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();

        StringBuffer buf = new StringBuffer();
        try {
            GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getGssCredentails();
            job.setCredentials(gssCred);
            // We do not support multiple gatekeepers in XBaya GUI, so we simply pick the 0th element in the array
            String gateKeeper = host.getGlobusGateKeeperEndPointArray(0);
            log.info("Request to contact:" + gateKeeper);

            log.info(job.getRSL());
            buf.append("Finished launching job, Host = ").append(host.getHostAddress()).append(" RSL = ")
                    .append(job.getRSL()).append(" working directory = ").append(app.getStaticWorkingDirectory())
                    .append(" temp directory = ").append(app.getScratchWorkingDirectory())
                    .append(" Globus GateKeeper Endpoint = ").append(gateKeeper);

            /*
            * The first boolean is to specify the job is a batch job - use true for interactive and false for batch.
            * The second boolean is to specify to use the full proxy and not delegate a limited proxy.
View Full Code Here

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

                command = "sh" + " " + type.getExecutable();
            }
            command = setCmdParams(jobExecutionContext, command);

        } else {
            ApplicationDeploymentDescriptionType type = appDesc.getType();
            command = "sh" + " " + type.getExecutableLocation();
            command = setCmdParams(jobExecutionContext, command);
        }

        return command + '\n';
    }
View Full Code Here

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

  private SSHSecurityContext securityContext;

  @Override
  public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException {
    securityContext = (SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT);
    ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
    String remoteFile = app.getStaticWorkingDirectory() + File.separatorChar + Constants.EXECUTABLE_NAME;
    log.info(remoteFile);
    try {
      File runscript = createShellScript(jobExecutionContext);
      SCPFileTransfer fileTransfer = securityContext.getSSHClient().newSCPFileTransfer();
      fileTransfer.upload(runscript.getAbsolutePath(), remoteFile);
View Full Code Here

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

    }
  }

  @Override
  public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException {
    ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
    Session session = null;
    try {
      session = securityContext.getSession(jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress());
      /*
       * Execute
       */
      String execuable = app.getStaticWorkingDirectory() + File.separatorChar + Constants.EXECUTABLE_NAME;
      Command cmd = session.exec("/bin/chmod 755 " + execuable + "; " + execuable);
      log.info("stdout=" + GFacUtils.readFromStream(session.getInputStream()));
      cmd.join(Constants.COMMAND_EXECUTION_TIMEOUT, TimeUnit.SECONDS);

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