コード例 #1
0
 def file_iterator(chunk_size=1024 * 2):
     while True:
         try:
             c = contents.read(chunk_size)
             result = c.decode('utf-8')
             result = CITaskHistoryService.format_build_log(result)
             if c:
                 yield result
             else:
                 break
         except Exception as ex:
             SimpleLogger.exception(ex)
             continue
コード例 #2
0
 def get_finished_step_log(self, task_history_id):
     result = None
     step_outputs = CITaskStepOutput.objects.filter(
         TaskHistoryID=int(task_history_id)).filter(
             StageHistoryID=0).filter(ProductType=1)
     if len(step_outputs) > 0:
         if step_outputs[0].ProductID:
             contents = CITaskHistoryService.get_big_build_log(
                 step_outputs[0].ProductID)
             temp_output = dict()
             temp_output["id"] = step_outputs[0].id
             temp_output["step_name"] = "完成"
             c = contents.read()
             log_content = c.decode('utf-8')
             log_content = CITaskHistoryService.format_build_log(
                 log_content)
             temp_output["log_content"] = log_content
             temp_output["show_content"] = True
             result = temp_output
     return result