def run(self):
done = False<EOL>dir_list = []<EOL>tic = time.clock()<EOL>lg.info('<STR_LIT>' + str(tic))<EOL>if self.run_params.num_cpus == -<NUM_LIT:1>:  <EOL><INDENT>self.run_params.num_cpus = os.sysconf("<STR_LIT>")<EOL>lg.info('<STR_LIT>' + str(self.run_params.num_cpus) + '<STR_LIT>')<EOL><DEDENT>tmp_dir_list = os.listdir(self.batch_output)<EOL>for direc in tmp_dir_list:<EOL><INDENT>dir_list.append(os.path.join(self.batch_output, direc))<EOL><DEDENT>num_dirs = len(dir_list)<EOL>lg.info('<STR_LIT>' + str(num_dirs) + '<STR_LIT>' + self.batch_output)<EOL>sub = scipy.floor(num_dirs / self.run_params.num_cpus)<EOL>remainder = num_dirs - (sub * self.run_params.num_cpus)<EOL>if remainder > <NUM_LIT:0>:<EOL><INDENT>lg.warning('<STR_LIT>')<EOL>lg.warning('<STR_LIT>')<EOL>lg.warning('<STR_LIT>' + str(remainder))<EOL><DEDENT>while not done:<EOL><INDENT>for l in range(<NUM_LIT:0>, int(sub)):<EOL><INDENT>lg.info('<STR_LIT>' + str(self.run_params.num_cpus) + '<STR_LIT>')<EOL>for m in range(<NUM_LIT:0>, self.run_params.num_cpus):<EOL><INDENT>_dir = dir_list.pop()<EOL>report_dir, report_file_name = os.path.split(self.run_params.report_file)<EOL>lg.debug(report_file_name)<EOL>lg.debug(os.path.join(_dir, report_file_name))<EOL>try:<EOL><INDENT>rep_size = os.path.getsize(os.path.join(_dir, report_file_name.strip('<STR_LIT:\n>')))<EOL>lg.debug('<STR_LIT>' + str(rep_size))<EOL><DEDENT>except:<EOL><INDENT>rep_size = <NUM_LIT:0><EOL><DEDENT>if rep_size < <NUM_LIT:1.0>:  <EOL><INDENT>lg.info('<STR_LIT>')<EOL>p = Process(target=self._run, args=(_dir,))<EOL><DEDENT>else:<EOL><INDENT>lg.warning('<STR_LIT>' + os.path.join(_dir, report_file_name.strip(<EOL>'<STR_LIT:\n>')) + '<STR_LIT>')<EOL>p = Process(target=self._dummy, args=(_dir,))<EOL><DEDENT>p.start()<EOL>lg.info('<STR_LIT>' + str(p.pid))<EOL><DEDENT>p.join()<EOL><DEDENT>self.run_params.num_cpus = remainder<EOL>remainder = <NUM_LIT:0><EOL>lg.info('<STR_LIT>')<EOL>sub = <NUM_LIT:1><EOL>if remainder == <NUM_LIT:0>:<EOL><INDENT>done = True<EOL><DEDENT><DEDENT>toc = time.clock()  <EOL>lg.info('<STR_LIT>' + str(toc))<EOL>timeTaken = toc - tic<EOL>lg.info('<STR_LIT>' + str(timeTaken))<EOL>
Distributes the work across the CPUs.  It actually uses _run()