def get_my_issue_item(self,user_id,user_role):
     issue_list_controll=self.get_my_issue_more(user_id,0,user_role)
     issue_count=len(IssueService.my_issue(user_id,user_role))
     key=str(user_id)+"_issue_searchkeyword"
     search_word=RedisService.get_value(key)
     pagefileds={"issue_list_controll":issue_list_controll,"issue_count":issue_count,"search_word":search_word}
     return self.get_webpart(pagefileds,ProjectIssuePath.issue_item_list)
Ejemplo n.º 2
0
 def search_issue(all_issue, user_id):
     key = str(user_id) + "_issue_searchkeyword"
     result = all_issue
     if RedisService.has_key(key):
         search_word = RedisService.get_value(key)
         result = result.filter(Title__icontains=search_word)
     return result
Ejemplo n.º 3
0
 def get(self,request, *args, **kwargs):
     result = ''
     task_queueid = self.kwargs.get('tq_id',None)
     try:
         if task_queueid:
             result = RedisService.get_value("ci_build_log"+str(task_queueid))
     except Exception as ex:
         SimpleLogger.exception(ex)
     return Response({'PreLog':result})
Ejemplo n.º 4
0
 def save_build_log(tq_id):
     file_name = "ci_build_log" + tq_id + ".log"
     build_log = RedisService.get_value("ci_build_log" + tq_id)
     result = MongoDBService.save_content_asfile(file_name, build_log,
                                                 BuildLogMongoFile)
     file_id = FileInfoService.add_file(0, result, file_name, 1, 0,
                                        len(build_log))
     task_history = CITaskHistory.objects.get_by_tqid(int(tq_id))
     if file_id:
         task_history.BuildLogID = file_id
     else:
         task_history.BuildLogID = 0
     task_history.save()
Ejemplo n.º 5
0
 def get(self,request, *args, **kwargs):
     task_id =int(self.kwargs['id'])
     operation = self.kwargs['operation'].strip(' ')
     build_parameter = self.request.GET.get('BuildParameter',None)
     task_uuid = self.request.GET.get('TaskUUID',None)
     task_queueid = self.request.GET.get('TQID',None)
     result = [0,'任务'+ str(task_id) +'指令下发失败,请联系管理员或者重试!']
     try:
         if operation == 'start':
             result = CITaskService.start_ci_task(request,task_id,build_parameter,0)
         if operation == 'stop' and task_uuid:
             result = CITaskService.stop_ci_task(request,task_id)
         if operation == 'prelog' and task_queueid:
             result = RedisService.get_value("ci_build_log"+str(task_queueid))
     except Exception as ex:
         SimpleLogger.exception(ex)
     return Response({'tqid': result[0], 'message': result[1],'TaskUUID': result[2]})
Ejemplo n.º 6
0
 def save_build_log(tq_id,tq_done=False):
     file_name="ci_build_log"+tq_id+".log"
     build_log=RedisService.get_value("ci_build_log"+tq_id)
     result=MongoDBService.save_content_asfile(file_name, build_log,BuildLogMongoFile)
     file_id=FileInfoService.add_file(0,result,file_name,1,0,len(build_log))
     RedisService.delete_value("ci_build_log" + tq_id)
     if tq_done:
         temp_output = CITaskStepOutput()
         temp_output.ProductType = 1
         temp_output.ProductID = file_id
         task_queue = TaskQueue.objects.get(int(tq_id))
         task_history = CITaskHistory.objects.get_history_by_uuid(task_queue.TaskUUID)
         temp_output.TaskHistoryID = task_history.id
         temp_output.TaskID = task_history.CITaskID
         temp_output.StepID = ""
         temp_output.StageHistoryID = 0
         temp_output.save()
     else:
         RedisService.set_value("ci_build_log"+tq_id,"")
     return file_id
Ejemplo n.º 7
0
 def get_build_log_content(self, tq_id):
     result = ""
     ci_build_logs = RedisService.get_value("ci_build_log" + tq_id)
     return ci_build_logs