def message_loop(self, t_q, r_q):
t_msg = {}<EOL>while t_msg.get("<STR_LIT:state>", "<STR_LIT>") != "<STR_LIT>":<EOL><INDENT>try:<EOL><INDENT>t_msg = t_q.get(True, self.cycle_sleep)  <EOL>self.task = t_msg.get("<STR_LIT>", "<STR_LIT>")  <EOL>if self.task != "<STR_LIT>":<EOL><INDENT>self.task.task_start = time.time()  <EOL>self.r_q_send(<EOL>{"<STR_LIT>": self.w_id, "<STR_LIT>": self.task, "<STR_LIT:state>": "<STR_LIT>"}<EOL>)<EOL>self.cycle_sleep = self.task.worker_loop_delay<EOL>self.task.result = self.task.run()<EOL>self.task.task_stop = time.time()  <EOL>self.r_q_send(<EOL>{"<STR_LIT>": self.w_id, "<STR_LIT>": self.task, "<STR_LIT:state>": "<STR_LIT>"}<EOL>)  <EOL>self.task = None<EOL><DEDENT><DEDENT>except Empty:<EOL><INDENT>pass<EOL><DEDENT>except Full:<EOL><INDENT>time.sleep(<NUM_LIT:0.1>)<EOL><DEDENT>except:<EOL><INDENT>if self.task is not None:<EOL><INDENT>self.task.task_stop = time.time()  <EOL><DEDENT>tb_str = "<STR_LIT>".join(tb.format_exception(*(sys.exc_info())))<EOL>self.r_q_send(<EOL>{<EOL>"<STR_LIT>": self.w_id,<EOL>"<STR_LIT>": self.task,<EOL>"<STR_LIT:error>": tb_str,<EOL>"<STR_LIT:state>": "<STR_LIT>",<EOL>}<EOL>)<EOL><DEDENT><DEDENT>return<EOL>
Loop through messages and execute tasks