def _worker(self):
logger.debug("<STR_LIT>")<EOL>try:<EOL><INDENT>self.gun.setup()<EOL><DEDENT>except Exception:<EOL><INDENT>logger.exception("<STR_LIT>")<EOL>return<EOL><DEDENT>while not self.quit.is_set():<EOL><INDENT>try:<EOL><INDENT>task = self.task_queue.get(timeout=<NUM_LIT:1>)<EOL>if not task:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>break<EOL><DEDENT>timestamp, missile, marker = task<EOL>planned_time = self.start_time + (timestamp / <NUM_LIT>)<EOL>delay = planned_time - time.time()<EOL>if delay > <NUM_LIT:0>:<EOL><INDENT>time.sleep(delay)<EOL><DEDENT>try:<EOL><INDENT>with self.instance_counter.get_lock():<EOL><INDENT>self.instance_counter.value += <NUM_LIT:1><EOL><DEDENT>self.gun.shoot(missile, marker)<EOL><DEDENT>finally:<EOL><INDENT>with self.instance_counter.get_lock():<EOL><INDENT>self.instance_counter.value -= <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>except (KeyboardInterrupt, SystemExit):<EOL><INDENT>break<EOL><DEDENT>except Empty:<EOL><INDENT>if self.quit.is_set():<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>return<EOL><DEDENT><DEDENT>except Full:<EOL><INDENT>logger.warning("<STR_LIT>")<EOL><DEDENT>except Exception:<EOL><INDENT>logger.exception("<STR_LIT>")<EOL><DEDENT><DEDENT>try:<EOL><INDENT>self.gun.teardown()<EOL><DEDENT>except Exception:<EOL><INDENT>logger.exception("<STR_LIT>")<EOL>return<EOL><DEDENT>logger.debug("<STR_LIT>")<EOL>
A worker that does actual jobs