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 { // 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 stderrURI = GfacUtils.createGsiftpURI(endpoint, app.getStandardError());
URI stderrURI = GramProviderUtils.createGsiftpURI(endpoint, app.getStandardError()); status.setTransferState(TransferState.COMPLETE); detail.setTransferStatus(status);
+ appDesc.getApplicationName().getStringValue() + ".stdout"); if (appDesc.getStandardError() == null) { appDesc.setStandardError(appDesc.getStaticWorkingDirectory() + File.separator + appDesc.getApplicationName().getStringValue() + ".stderr");
applicationDescriptor.setStdOut(applicationDescription.getType().getStandardOutput()); if (applicationDescription.getType().getStandardError() != null && !applicationDescription.getType().getStandardError().equals("")){ applicationDescriptor.setStdError(applicationDescription.getType().getStandardError());