Thread t1 = new ReadStreamWriteFile(process.getInputStream(), app.getStandardOutput()); Thread t2 = new ReadStreamWriteFile(process.getErrorStream(), app.getStandardError());
public void setupEnvironment(InvocationContext context) throws ProviderException { ApplicationDeploymentDescriptionType app = context.getExecutionDescription().getApp().getType(); // input parameter ArrayList<String> tmp = new ArrayList<String>(); for (Iterator<String> iterator = context.getInput().getNames(); iterator.hasNext();) { String key = iterator.next(); tmp.add(context.getInput().getStringValue(key)); } List<String> cmdList = new ArrayList<String>(); /* * Builder Command */ cmdList.add(app.getExecutableLocation()); cmdList.addAll(tmp); // create process builder from command command = InputUtils.buildCommand(cmdList); // redirect StdOut and StdErr // TODO: Make 1> and 2> into static constants. // TODO: This only works for the BASH shell. CSH and TCSH will be // different. command += SPACE + "1>" + SPACE + app.getStandardOutput(); command += SPACE + "2>" + SPACE + app.getStandardError(); }
public Map<String, ?> processOutput(InvocationContext context) throws ProviderException { ApplicationDeploymentDescriptionType app = context.getExecutionDescription().getApp().getType(); try { String stdOutStr = GfacUtils.readFileToString(app.getStandardOutput()); // set to context return OutputUtils.fillOutputFromStdout(context.<ActualParameter> getOutput(), stdOutStr); } catch (XmlException e) { throw new ProviderException("Cannot read output:" + e.getMessage(), e); } catch (IOException io) { throw new ProviderException(io.getMessage(), io); } } }
public Map<String, ?> processOutput(InvocationContext context) throws ProviderException { ApplicationDeploymentDescriptionType app = context.getExecutionDescription().getApp().getType(); try { // Get the Stdouts and StdErrs String timeStampedServiceName = GfacUtils.createUniqueNameForService(context.getServiceName()); File localStdOutFile = File.createTempFile(timeStampedServiceName, "stdout"); File localStdErrFile = File.createTempFile(timeStampedServiceName, "stderr"); SCPFileTransfer fileTransfer = ssh.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()); return OutputUtils.fillOutputFromStdout(context.<ActualParameter> getOutput(), stdOutStr); } catch (XmlException e) { throw new ProviderException("Cannot read output:" + e.getMessage(), e); } catch (ConnectionException e) { throw new ProviderException(e.getMessage(), e); } catch (TransportException e) { throw new ProviderException(e.getMessage(), e); } catch (IOException e) { throw new ProviderException(e.getMessage(), e); } }
URI stdoutURI = GfacUtils.createGsiftpURI(endpoint, app.getStandardOutput()); URI stderrURI = GfacUtils.createGsiftpURI(endpoint, app.getStandardError());
URI stdoutURI = GramProviderUtils.createGsiftpURI(endpoint, app.getStandardOutput()); URI stderrURI = GramProviderUtils.createGsiftpURI(endpoint, app.getStandardError()); status.setTransferState(TransferState.COMPLETE);
if (appDesc.getStandardOutput() == null) { appDesc.setStandardOutput(appDesc.getStaticWorkingDirectory() + File.separator + appDesc.getApplicationName().getStringValue() + ".stdout");
applicationDescriptor.setStdIn(applicationDescription.getType().getStandardInput()); if (applicationDescription.getType().getStandardOutput() != null && !applicationDescription.getType().getStandardOutput().equals("")){ applicationDescriptor.setStdOut(applicationDescription.getType().getStandardOutput());