Ejemplo n.º 1
0
 def __createProc(self, pdag, scmd, stdin, stderr, isLast):
     "define one process in the command, return stdout"
     if isLast:
         stdout = self.__getOutput(pdag, self.stdout)
     else:
         stdout = Pipeline.Pipe()
     # convert arguments
     pcmd = []
     for a in scmd:
         if isinstance(a, FileIn):
             pcmd.append(self.__getInput(pdag, a))
         elif isinstance(a, FileOut):
             pcmd.append(self.__getOutput(pdag, a))
         else:
             pcmd.append(str(a))
     pdag.create(pcmd, stdin, stdout, stderr)
     return stdout
Ejemplo n.º 2
0
    def __getOutput(self, pdag, fspec):
        """Get an output file. If fspec can be None, File or FileOut, or any
        object that can be converted to a string.  Return the appropriate Pout
        object, None, or a string. Adds compression process if needed."""
        if fspec == None:
            return None
        if isinstance(fspec, File):
            fspec = FileOut(fspec)
        if not isinstance(fspec, FileOut):
            return str(fspec)

        # handle File object, include arg prefix
        path = fspec.file.getOutPath()
        if fileOps.isCompressed(path) and fspec.autoCompress:
            pdev = Pipeline.Pipe()
            pdag.create((fileOps.compressCmd(path), ), stdin=pdev, stdout=path)
            return Pipeline.POut(pdev, fspec.prefix)
        else:
            return Pipeline.POut(Pipeline.File(path), fspec.prefix)