示例#1
0
 def done_task(self, task):
     for msg in get_pretty_lines(task.get_out_msgs(), 10):
         self.logger.info('\t[out]: {0}'.format(msg))
     for msg in get_pretty_lines(task.get_err_msgs(), 50):
         self.logger.info('\t[err]: {0}'.format(msg))
     if task.is_failed():
         task.fail_action.do()
     if not self.stopped:
         self.add_ready_tasks(task)
     if len(self.ready) == 0:
         self.stopped = True
示例#2
0
文件: task.py 项目: cutefish/PyUtils
 def pass_expect_or_die(self, out, curr_id):
     out_idx = 0
     expect_idx = 0
     while (out_idx < len(out)) and (expect_idx < len(self.expects)):
         out_string = out[out_idx]
         expect_regex = self.expects[expect_idx]
         expect_regex = re.sub(self.sub_regex, curr_id, expect_regex)
         if re.search(expect_regex, out_string) is not None:
             expect_idx += 1
         out_idx += 1
     if expect_idx < len(self.expects):
         expect_regex = self.expects[expect_idx]
         expect_regex = re.sub(self.sub_regex, curr_id, expect_regex)
         raise ValueError('Out not matching expected. Unmatched: {0}; out:{1}'.
                          format(expect_regex, get_pretty_lines(out, 20)))