def poll(self):
finished_procs = [p for p in self.running_procs if p.poll() is not None]<EOL>self.running_procs = collections.deque([p for p in self.running_procs if p not in finished_procs])<EOL>for proc in finished_procs:<EOL><INDENT>stdout, stderr = proc.communicate()<EOL><DEDENT>finished_pids = [p.pid for p in finished_procs]<EOL>self.finished_pids.extend(finished_pids)<EOL>logger = logging.getLogger(__name__)<EOL>messages = '<STR_LIT>'.format(len(self.running_procs), len(self.finished_pids))<EOL>logger.info(messages)<EOL>return finished_pids<EOL>
check if the jobs are running and return a list of pids for
        finished jobs