def respawn_dead_workers(self):
for w_id, p in self.workers.items():<EOL><INDENT>if not p.is_alive():<EOL><INDENT>if self.log_level >= <NUM_LIT:2>:<EOL><INDENT>self.log.info("<STR_LIT>".format(w_id))<EOL><DEDENT>task = self.worker_assignments.get(w_id, {})<EOL>if self.log_level >= <NUM_LIT:2> and task != {}:<EOL><INDENT>self.log.info(<EOL>"<STR_LIT>".format(<EOL>w_id, task<EOL>)<EOL>)<EOL><DEDENT>error_suffix = "<STR_LIT>"<EOL>if task != {}:<EOL><INDENT>del self.worker_assignments[w_id]<EOL>if self.resubmit_on_error or self.hot_loop:<EOL><INDENT>self.work_todo.append(task)<EOL>self.queue_task(task)<EOL>if self.log_level >= <NUM_LIT:2>:<EOL><INDENT>self.log.info("<STR_LIT>".format(task))<EOL><DEDENT>error_suffix = "<STR_LIT>".format(task)<EOL><DEDENT><DEDENT>if self.log_level >= <NUM_LIT:1>:<EOL><INDENT>self.log.debug(<EOL>"<STR_LIT>".format(len(self.work_todo))<EOL>)<EOL><DEDENT>if self.log_level >= <NUM_LIT:2>:<EOL><INDENT>self.log.info(<EOL>"<STR_LIT>".format(w_id, error_suffix)<EOL>)<EOL><DEDENT>self.workers[w_id] = Process(<EOL>target=Worker,<EOL>args=(w_id, self.t_q, self.r_q, self.worker_cycle_sleep),<EOL>)<EOL>self.workers[w_id].daemon = True<EOL>self.workers[w_id].start()<EOL><DEDENT><DEDENT>
Respawn workers / tasks upon crash