def runJobs(self):
        """run jobs.

        This uses forking which is not without problems:

        * too many open files.

        Thus, running in chunks.
        """

        self.mResults = []

        if self.mNumJobs:
            chunks = range(0, len(self.mJobs), self.mNumJobs)
            chunks.append(len(self.mJobs))
        else:
            chunks = [0, len(self.mJobs)]

        for x in range(len(chunks) - 1):

            pids = []

            for job in self.mJobs[chunks[x]:chunks[x + 1]]:

                pid = os.fork()

                if not pid:
                    os.nice(20)
                    # TODO: deal with return values
                    out, err = self.__runJob(job)
                    self.mResults.append((out, err))
                    break
                else:
                    pids.append(pid)

            for pid in pids:
                os.waitpid(pid, 0)

        return self.mResults
dataset/ETHPy150Open CGATOxford/cgat/obsolete/Cluster.py/Cluster.runJobs/original