def check_worker_health(self):
self._logger.debug('<STR_LIT>')<EOL>workers = []<EOL>restart_occurred = False<EOL>for i, (worker, worker_t) in enumerate(self.worker_threads):<EOL><INDENT>if not self.environment.is_alive(worker_t):<EOL><INDENT>self._logger.warning('<STR_LIT>', i + <NUM_LIT:1>)<EOL>worker = self._create_worker()<EOL>worker_t = self._create_process(worker, '<STR_LIT>' % (i + <NUM_LIT:1>))<EOL>worker_t.start()<EOL>restart_occurred = True<EOL><DEDENT>workers.append((worker, worker_t))<EOL><DEDENT>if restart_occurred:<EOL><INDENT>self.worker_threads = workers<EOL><DEDENT>else:<EOL><INDENT>self._logger.debug('<STR_LIT>')<EOL><DEDENT>if not self.environment.is_alive(self.scheduler):<EOL><INDENT>self._logger.warning('<STR_LIT>')<EOL>scheduler = self._create_scheduler()<EOL>self.scheduler = self._create_process(scheduler, '<STR_LIT>')<EOL>self.scheduler.start()<EOL><DEDENT>else:<EOL><INDENT>self._logger.debug('<STR_LIT>')<EOL><DEDENT>return not restart_occurred<EOL>
Check the health of the worker processes. Workers that have died will
be replaced with new workers.