/** * Construct a {@link SubProcessHeavy SubProcessHeavy} instance which when executed will fulfill * the given action agenda. * * <p> * * @param agenda The agenda to be accomplished by the action. * @param outFile The file to which all STDOUT output is redirected. * @param errFile The file to which all STDERR output is redirected. * @return The SubProcess which will fulfill the agenda. * @throws PipelineException If unable to prepare a SubProcess due to illegal, missing or * imcompatable information in the action agenda or a general failure of the prep method code. */ public SubProcessHeavy prep(ActionAgenda agenda, File outFile, File errFile) throws PipelineException { /* create the process to run the action */ try { ArrayList<String> args = new ArrayList<String>(); for (File file : agenda.getPrimaryTarget().getFiles()) args.add(file.toString()); for (FileSeq fseq : agenda.getSecondaryTargets()) { for (File file : fseq.getFiles()) args.add(file.toString()); } return new SubProcessHeavy( agenda.getNodeID().getAuthor(), getName() + "-" + agenda.getJobID(), "touch", args, agenda.getEnvironment(), agenda.getWorkingDir(), outFile, errFile); } catch (Exception ex) { throw new PipelineException( "Unable to generate the SubProcess to perform this Action!\n" + ex.getMessage()); } }
/** * Construct a {@link SubProcessHeavy SubProcessHeavy} instance which when executed will fulfill * the given action agenda. * * <p> * * @param agenda The agenda to be accomplished by the action. * @param outFile The file to which all STDOUT output is redirected. * @param errFile The file to which all STDERR output is redirected. * @return The SubProcess which will fulfill the agenda. * @throws PipelineException If unable to prepare a SubProcess due to illegal, missing or * imcompatable information in the action agenda or a general failure of the prep method code. */ public SubProcessHeavy prep(ActionAgenda agenda, File outFile, File errFile) throws PipelineException { NodeID nodeID = agenda.getNodeID(); /* sanity checks */ String opname = null; File source = null; File preRender = null; File postRender = null; File preFrame = null; File postFrame = null; { { FileSeq fseq = agenda.getPrimaryTarget(); if (!fseq.hasFrameNumbers()) throw new PipelineException( "The HfsComposite Action requires that the output images have frame numbers."); } /* generate the filename of the Houdini scene to load */ { String sname = (String) getSingleParamValue("HoudiniScene"); if (sname != null) { FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow the Houdini Scene node (" + sname + ") was not one of the source " + "nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !suffix.equals("hip")) throw new PipelineException( "The HfsComposite Action requires that the source node specified by the " + "Houdini Scene parameter (" + sname + ") must have a single Houdini scene " + "file (.hip) as its primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); source = new File(PackageInfo.sProdDir, snodeID.getWorkingParent() + "/" + fseq.getFile(0)); } else { throw new PipelineException( "The HfsComposite Action requires the Houdini Scene parameter to be set!"); } } /* the full name of the geometry output operator */ { String name = (String) getSingleParamValue("OutputOperator"); if ((name == null) || (name.length() == 0)) throw new PipelineException( "The HfsComposite Action requires a valid Output Operator name!"); opname = ("/out/" + name); } /* command script files */ { String sname = (String) getSingleParamValue("PreRenderScript"); if (sname != null) { FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow the Pre Render Script node (" + sname + ") was not one of the " + "source nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !(suffix.equals("cmd"))) throw new PipelineException( "The HfsComposite Action requires that the source node specified by the Pre " + "Render Script parameter (" + sname + ") must have a single command script " + "(.cmd) as its primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); preRender = new File(PackageInfo.sProdDir, snodeID.getWorkingParent() + "/" + fseq.getFile(0)); } } { String sname = (String) getSingleParamValue("PostRenderScript"); if (sname != null) { FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow the Post Render Script node (" + sname + ") was not one of the " + "source nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !(suffix.equals("cmd"))) throw new PipelineException( "The HfsComposite Action requires that the source node specified by the " + "Post Render Script parameter (" + sname + ") must have a single command " + "script (.cmd) as its primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); postRender = new File(PackageInfo.sProdDir, snodeID.getWorkingParent() + "/" + fseq.getFile(0)); } } { String sname = (String) getSingleParamValue("PreFrameScript"); if (sname != null) { FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow the Pre Frame Script node (" + sname + ") was not one of the " + "source nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !(suffix.equals("cmd"))) throw new PipelineException( "The HfsComposite Action requires that the source node specified by the Pre " + "Frame Script parameter (" + sname + ") must have a single command script " + "(.cmd) as its primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); preFrame = new File(PackageInfo.sProdDir, snodeID.getWorkingParent() + "/" + fseq.getFile(0)); } } { String sname = (String) getSingleParamValue("PostFrameScript"); if (sname != null) { FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow the Post Frame Script node (" + sname + ") was not one of the " + "source nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !(suffix.equals("cmd"))) throw new PipelineException( "The HfsComposite Action requires that the source node specified by the " + "Post Frame Script parameter (" + sname + ") must have a single command " + "script (.cmd) as its primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); postFrame = new File(PackageInfo.sProdDir, snodeID.getWorkingParent() + "/" + fseq.getFile(0)); } } } /* create the temporary Houdini command script */ File hscript = createTemp(agenda, 0644, "cmd"); try { FileWriter out = new FileWriter(hscript); FileSeq fseq = new FileSeq( PackageInfo.sProdDir.getPath() + nodeID.getWorkingParent(), agenda.getPrimaryTarget()); if (fseq.hasFrameNumbers()) { FilePattern fpat = fseq.getFilePattern(); FrameRange frange = fseq.getFrameRange(); out.write( "opparm " + opname + " trange on\n" + "opparm " + opname + " f1 " + frange.getStart() + "\n" + "opparm " + opname + " f2 " + frange.getEnd() + "\n" + "opparm " + opname + " f3 " + frange.getBy() + "\n" + "opparm " + opname + " copoutput '" + fpat.getPrefix() + ".$F"); if (fpat.getPadding() > 1) out.write(String.valueOf(fpat.getPadding())); out.write("." + fpat.getSuffix() + "'\n"); } else { out.write("opparm " + opname + " trange off\n" + "opparm " + opname + " " + fseq + "\n"); } if (preRender != null) out.write("opparm " + opname + " prerender '" + preRender + "'\n"); if (postRender != null) out.write("opparm " + opname + " postrender '" + postRender + "'\n"); if (preFrame != null) out.write("opparm " + opname + " preframe '" + preFrame + "'\n"); if (postFrame != null) out.write("opparm " + opname + " postframe '" + postFrame + "'\n"); out.write("opparm -c " + opname + " execute\n"); out.close(); } catch (IOException ex) { throw new PipelineException( "Unable to write temporary script file (" + hscript + ") for Job " + "(" + agenda.getJobID() + ")!\n" + ex.getMessage()); } /* create the wrapper shell script */ File script = createTemp(agenda, 0755, "bash"); try { FileWriter out = new FileWriter(script); out.write("#!/bin/bash\n\n" + "cat " + hscript + " | hscript -v " + source); out.close(); } catch (IOException ex) { throw new PipelineException( "Unable to write temporary script file (" + script + ") for Job " + "(" + agenda.getJobID() + ")!\n" + ex.getMessage()); } try { return new SubProcessHeavy( agenda.getNodeID().getAuthor(), getName() + "-" + agenda.getJobID(), script.getPath(), new ArrayList<String>(), agenda.getEnvironment(), agenda.getWorkingDir(), outFile, errFile); } catch (Exception ex) { throw new PipelineException( "Unable to generate the SubProcess to perform this Action!\n" + ex.getMessage()); } }
/** * Phase in which parameter values should be extracted from parameters and checked for * consistency and applicability. */ @Override public void validatePhase() throws PipelineException { /* sets up the built-in parameters common to all builders */ validateBuiltInParams(); /* setup the StudioDefinitions version of the UtilContext */ pStudioDefs.setContext(pContext); /* lookup the source images node */ String sourceNodeName = null; VersionID sourceVersionID = null; { Path spath = (Path) getParamValue(aSourceNode); if (spath == null) throw new PipelineException("No " + aSourceNode + " was specified!"); sourceNodeName = spath.toString(); pSourcePrefix = spath.getName(); String sversion = (String) getParamValue(aSourceVersion); if (sversion == null) throw new PipelineException("No " + aSourceVersion + " was specified!"); try { sourceVersionID = new VersionID(sversion); } catch (Exception ex) { throw new PipelineException( "The value supplied for the " + aSourceVersion + " parameter " + "(" + sversion + ") is not a legal node revision number!\n\n" + ex.getMessage()); } try { pSourceVersion = pClient.getCheckedInVersion(sourceNodeName, sourceVersionID); } catch (PipelineException ex) { throw new PipelineException( "The source images node (" + sourceNodeName + " v" + sourceVersionID + ") " + "does not exist!"); } } /* set namer/builder parameters based on the annotations on the source images node */ { boolean validated = false; String projName = null; String taskName = null; String taskType = null; TreeMap<String, BaseAnnotation> annotations = pClient.getAnnotations(sourceNodeName); TreeSet<String> otherPurposes = new TreeSet<String>(); for (String aname : annotations.keySet()) { if (aname.equals("Task") || aname.startsWith("AltTask")) { BaseAnnotation annot = annotations.get(aname); String purpose = lookupPurpose(sourceNodeName, aname, annot); if (purpose == null) { otherPurposes.add("<UNKNWON>"); } else if (purpose.equals(aFocus) || purpose.equals(aEdit) || purpose.equals(aProduct)) { projName = lookupProjectName(sourceNodeName, aname, annot); taskName = lookupTaskName(sourceNodeName, aname, annot); taskType = lookupTaskType(sourceNodeName, aname, annot); validated = true; break; } else { otherPurposes.add(purpose); } } } if (!validated) { StringBuilder buf = new StringBuilder(); buf.append( "Unable to find an valid " + aEdit + ", " + aFocus + " or " + aProduct + " " + "task annotation for the source images node (" + sourceNodeName + " v" + sourceVersionID + ")!"); if (!otherPurposes.isEmpty()) { buf.append( "\n\nHowever, there were task annotations on the source images node for " + "the following unsupported purposes:"); for (String purpose : otherPurposes) buf.append(" " + purpose); } throw new PipelineException(buf.toString()); } if (taskName.length() != 5) throw new PipelineException( "The " + aTaskName + " (" + taskName + ") of the source images " + "node (" + sourceNodeName + " v" + sourceVersionID + ") did not conform to " + "the 2-letter sequence name followed by 3-digit shot number format!"); pProjectName = projName; pSeqName = taskName.substring(0, 2); pShotName = taskName.substring(2, 5); try { pTaskType = TaskType.valueOf(TaskType.class, taskType); } catch (IllegalArgumentException ex) { throw new PipelineException( "The " + DeliverNamer.aTaskType + " (" + taskType + ") of the source images " + "node (" + sourceNodeName + " v" + sourceVersionID + ") was an unknown type " + "by this builder!"); } } /* generate a temporary working area where the approval process will take place and change the util context to use it instead for all future operations */ { String tempView = ("QtDeliver" + "-" + pProjectName + "-" + pSeqName + pShotName + "-" + pSourcePrefix); tempView = tempView.replaceAll(" ", "_"); setContext(new UtilContext(pContext.getAuthor(), tempView, pContext.getToolset())); } /* turn on the DoAnnotations flag for the StageInformation shared by all of the Stages created by this builder since we always want task annotations */ getStageInformation().setDoAnnotations(true); /* initialize internal Project namer */ { pProjectNamer.setParamValue(new ParamMapping(StudioDefinitions.aProjectName), pProjectName); pProjectNamer.generateNames(); } }
/** * Construct a {@link SubProcessHeavy SubProcessHeavy} instance which when executed will fulfill * the given action agenda. * * <p> * * @param agenda The agenda to be accomplished by the action. * @param outFile The file to which all STDOUT output is redirected. * @param errFile The file to which all STDERR output is redirected. * @return The SubProcess which will fulfill the agenda. * @throws PipelineException If unable to prepare a SubProcess due to illegal, missing or * imcompatable information in the action agenda or a general failure of the prep method code. */ public SubProcessHeavy prep(ActionAgenda agenda, File outFile, File errFile) throws PipelineException { NodeID nodeID = agenda.getNodeID(); /* sanity checks */ Path loadScene = null; Path saveScene = null; boolean isAscii = false; TreeMap<Integer, LinkedList<Path>> mel = new TreeMap<Integer, LinkedList<Path>>(); { /* generate the filename of the Maya scene to load */ { String sname = (String) getSingleParamValue("MayaScene"); if (sname != null) { FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow the Maya Scene node (" + sname + ") was not one of the source " + "nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !(suffix.equals("ma") || suffix.equals("mb"))) throw new PipelineException( "The MayaMEL Action requires that the source node specified by the Maya " + "Scene parameter (" + sname + ") must have a single Maya scene file as " + "its primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); loadScene = new Path(PackageInfo.sProdPath, snodeID.getWorkingParent() + "/" + fseq.getPath(0)); } } /* generate the name of the Maya scene to save */ { Boolean save = (Boolean) getSingleParamValue("SaveResult"); if ((save != null) && save) { FileSeq fseq = agenda.getPrimaryTarget(); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !(suffix.equals("ma") || suffix.equals("mb"))) throw new PipelineException( "The MayaMEL Action requires that the primary target file sequence must " + "be a single Maya scene file if the Save Result parameter is set!"); isAscii = suffix.equals("ma"); saveScene = new Path(PackageInfo.sProdPath, nodeID.getWorkingParent() + "/" + fseq.getPath(0)); } } /* generate the table of MEL script files to evaluate */ for (String sname : getSourceNames()) { Integer order = (Integer) getSourceParamValue(sname, "Order"); FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow an per-source Order parameter exists for a node (" + sname + ") " + "which was not one of the source nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !suffix.equals("mel")) throw new PipelineException( "The MayaMEL Action requires that the source node (" + sname + ") with " + "per-source Order parameter must have a single MEL script file as its " + "primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); Path script = new Path(PackageInfo.sProdPath, snodeID.getWorkingParent() + "/" + fseq.getPath(0)); LinkedList<Path> scripts = mel.get(order); if (scripts == null) { scripts = new LinkedList<Path>(); mel.put(order, scripts); } scripts.add(script); } } /* create a temporary MEL script file */ File script = createTemp(agenda, 0755, "mel"); try { FileWriter out = new FileWriter(script); /* a workaround needed in "maya -batch" mode */ out.write("// WORK AROUNDS:\n" + "lightlink -q;\n\n"); /* rename the current scene as the output scene */ if (saveScene != null) { out.write( "// SCENE SETUP\n" + "file -rename \"" + saveScene + "\";\n" + "file -type \"" + (isAscii ? "mayaAscii" : "mayaBinary") + "\";\n\n"); } /* evaluate the MEL scripts */ if (!mel.isEmpty()) { out.write("// MEL SCRIPTS \n"); for (LinkedList<Path> scripts : mel.values()) { for (Path spath : scripts) out.write("source \"" + spath + "\";\n"); } out.write("\n"); } /* save the file */ if (saveScene != null) out.write("// SAVE\n" + "file -save;\n"); out.close(); } catch (IOException ex) { throw new PipelineException( "Unable to write temporary MEL script file (" + script + ") for Job " + "(" + agenda.getJobID() + ")!\n" + ex.getMessage()); } /* create the process to run the action */ try { ArrayList<String> args = new ArrayList<String>(); args.add("-batch"); args.add("-script"); args.add(script.getPath()); if (loadScene != null) { args.add("-file"); args.add(loadScene.toOsString()); } String program = "maya"; if (PackageInfo.sOsType == OsType.Windows) program = (program + ".exe"); return new SubProcessHeavy( agenda.getNodeID().getAuthor(), getName() + "-" + agenda.getJobID(), program, args, agenda.getEnvironment(), agenda.getWorkingDir(), outFile, errFile); } catch (Exception ex) { throw new PipelineException( "Unable to generate the SubProcess to perform this Action!\n" + ex.getMessage()); } }
/** * Construct a {@link SubProcessHeavy SubProcessHeavy} instance which when executed will fulfill * the given action agenda. * * <p> * * @param agenda The agenda to be accomplished by the action. * @param outFile The file to which all STDOUT output is redirected. * @param errFile The file to which all STDERR output is redirected. * @return The SubProcess which will fulfill the agenda. * @throws PipelineException If unable to prepare a SubProcess due to illegal, missing or * imcompatable information in the action agenda or a general failure of the prep method code. */ public SubProcessHeavy prep(ActionAgenda agenda, File outFile, File errFile) throws PipelineException { NodeID nodeID = agenda.getNodeID(); /* sanity checks */ File targetScene = null; ArrayList<File> sourceScenes = new ArrayList<File>(); ArrayList<String> mergePatterns = new ArrayList<String>(); File preBuild = null; File postBuild = null; File preScene = null; File postScene = null; { DoubleMap<Integer, String, TreeSet<FileSeq>> sources = new DoubleMap<Integer, String, TreeSet<FileSeq>>(); for (String sname : agenda.getSourceNames()) { if (hasSourceParams(sname)) { FileSeq fseq = agenda.getPrimarySource(sname); Integer order = (Integer) getSourceParamValue(sname, "Order"); addSourceSeq(order, sname, fseq, sources); } for (FileSeq fseq : agenda.getSecondarySources(sname)) { FilePattern fpat = fseq.getFilePattern(); if (hasSecondarySourceParams(sname, fpat)) { Integer order = (Integer) getSecondarySourceParamValue(sname, fpat, "Order"); addSourceSeq(order, sname, fseq, sources); } } } for (Integer order : sources.keySet()) { for (String sname : sources.get(order).keySet()) { for (FileSeq fseq : sources.get(order).get(sname)) { String pattern = null; if (fseq.equals(agenda.getPrimarySource(sname))) pattern = (String) getSourceParamValue(sname, "MergePattern"); else { FilePattern fpat = fseq.getFilePattern(); pattern = (String) getSecondarySourceParamValue(sname, fpat, "MergePattern"); } if ((pattern == null) || (pattern.length() == 0)) throw new PipelineException( "The Merge Pattern for file sequence (" + fseq + ") of source node " + "(" + sname + ") was not specified!"); NodeID snodeID = new NodeID(nodeID, sname); File sfile = new File(PackageInfo.sProdDir, snodeID.getWorkingParent() + "/" + fseq.getFile(0)); sourceScenes.add(sfile); mergePatterns.add(pattern); } } } /* generate the name of the Houdini scene to save */ { FileSeq fseq = agenda.getPrimaryTarget(); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !suffix.equals("hip")) throw new PipelineException( "The HfsBuild Action requires that the primary target file sequence must " + "be a single Houdini scene file!"); targetScene = new File(PackageInfo.sProdDir, nodeID.getWorkingParent() + "/" + fseq.getFile(0)); } /* command script files */ { String sname = (String) getSingleParamValue("PreBuildScript"); if (sname != null) { FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow the Pre Build Script node (" + sname + ") was not one of the " + "source nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !(suffix.equals("cmd"))) throw new PipelineException( "The HfsBuild Action requires that the source node specified by the Pre " + "Build Script parameter (" + sname + ") must have a single command " + "script (.cmd) as its primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); preBuild = new File(PackageInfo.sProdDir, snodeID.getWorkingParent() + "/" + fseq.getFile(0)); } } { String sname = (String) getSingleParamValue("PostBuildScript"); if (sname != null) { FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow the Post Build Script node (" + sname + ") was not one of the " + "source nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !(suffix.equals("cmd"))) throw new PipelineException( "The HfsBuild Action requires that the source node specified by the Post " + "Build Script parameter (" + sname + ") must have a single command " + "script (.cmd) as its primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); postBuild = new File(PackageInfo.sProdDir, snodeID.getWorkingParent() + "/" + fseq.getFile(0)); } } { String sname = (String) getSingleParamValue("PreSceneScript"); if (sname != null) { FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow the Pre Scene Script node (" + sname + ") was not one of the " + "source nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !(suffix.equals("cmd"))) throw new PipelineException( "The HfsBuild Action requires that the source node specified by the Pre " + "Scene Script parameter (" + sname + ") must have a single command script " + "(.cmd) as its primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); preScene = new File(PackageInfo.sProdDir, snodeID.getWorkingParent() + "/" + fseq.getFile(0)); } } { String sname = (String) getSingleParamValue("PostSceneScript"); if (sname != null) { FileSeq fseq = agenda.getPrimarySource(sname); if (fseq == null) throw new PipelineException( "Somehow the Post Scene Script node (" + sname + ") was not one of the " + "source nodes!"); String suffix = fseq.getFilePattern().getSuffix(); if (!fseq.isSingle() || (suffix == null) || !(suffix.equals("cmd"))) throw new PipelineException( "The HfsBuild Action requires that the source node specified by the Post " + "Scene Script parameter (" + sname + ") must have a single command script " + "(.cmd) as its primary file sequence!"); NodeID snodeID = new NodeID(nodeID, sname); postScene = new File(PackageInfo.sProdDir, snodeID.getWorkingParent() + "/" + fseq.getFile(0)); } } } /* create the temporary Houdini command script */ File hscript = createTemp(agenda, 0644, "cmd"); try { FileWriter out = new FileWriter(hscript); if (preBuild != null) out.write("source " + preBuild + "\n"); /* load the source scenes */ int wk; for (wk = 0; wk < sourceScenes.size(); wk++) { File sourceScene = sourceScenes.get(wk); String pattern = mergePatterns.get(wk); if (preScene != null) out.write("source " + preScene + "\n"); out.write("mread"); if (wk > 0) out.write(" -o -m " + pattern); out.write(" " + sourceScene + "\n"); if (postScene != null) out.write("source " + postScene + "\n"); } if (postBuild != null) out.write("source " + postBuild + "\n"); /* save the file */ out.write("mwrite " + targetScene + "\n"); out.close(); } catch (IOException ex) { throw new PipelineException( "Unable to write temporary command file (" + hscript + ") for Job " + "(" + agenda.getJobID() + ")!\n" + ex.getMessage()); } /* create the wrapper shell script */ File script = createTemp(agenda, 0755, "bash"); try { FileWriter out = new FileWriter(script); out.write("#!/bin/bash\n\n" + "cat " + hscript + " | hscript"); out.close(); } catch (IOException ex) { throw new PipelineException( "Unable to write temporary script file (" + script + ") for Job " + "(" + agenda.getJobID() + ")!\n" + ex.getMessage()); } try { return new SubProcessHeavy( agenda.getNodeID().getAuthor(), getName() + "-" + agenda.getJobID(), script.getPath(), new ArrayList<String>(), agenda.getEnvironment(), agenda.getWorkingDir(), outFile, errFile); } catch (Exception ex) { throw new PipelineException( "Unable to generate the SubProcess to perform this Action!\n" + ex.getMessage()); } }