Exemplo n.º 1
0
 def formatWorkflow(self, results):
     workflow = {}
     tran = Transitions()
     for result in results:
         if not workflow.has_key(result["wmspec"]):
             workflow[result["wmspec"]] = {}
             for state in tran.states():
                 workflow[result["wmspec"]][state] = 0
                 
             workflow[result["wmspec"]][result["state"]] = result["num_job"]
             workflow[result["wmspec"]]['total_jobs'] = result["num_job"]
             workflow[result["wmspec"]]["real_success"] = int(result["success"])
             workflow[result["wmspec"]]["id"] = result["id"]
             workflow[result["wmspec"]]["wmspec"] = result["wmspec"]
             workflow[result["wmspec"]]["pending"] = self.pendingCount(result)
             workflow[result["wmspec"]]["real_fail"] = self.failCount(result)
             workflow[result["wmspec"]]['processing'] = self.processingCount(result)
         else:
             workflow[result["wmspec"]][result["state"]] = result["num_job"]
             workflow[result["wmspec"]]['total_jobs'] += result["num_job"]
             workflow[result["wmspec"]]["real_success"] += int(result["success"])
             workflow[result["wmspec"]]["pending"] += self.pendingCount(result)
             workflow[result["wmspec"]]["real_fail"] += self.failCount(result)
             workflow[result["wmspec"]]['processing'] += self.processingCount(result)
     
     # need to order by id (client side)        
     return workflow.values()
Exemplo n.º 2
0
    def formatWorkflow(self, results):
        workflow = {}
        tran = Transitions()
        for result in results:
            if result["wmspec"] not in workflow:
                workflow[result["wmspec"]] = {}
                for state in tran.states():
                    workflow[result["wmspec"]][state] = 0

                workflow[result["wmspec"]][result["state"]] = result["num_job"]
                workflow[result["wmspec"]]['total_jobs'] = result["num_job"]
                workflow[result["wmspec"]]["real_success"] = int(
                    result["success"])
                workflow[result["wmspec"]]["id"] = result["id"]
                workflow[result["wmspec"]]["wmspec"] = result["wmspec"]
                workflow[result["wmspec"]]["pending"] = self.pendingCount(
                    result)
                workflow[result["wmspec"]]["real_fail"] = self.failCount(
                    result)
                workflow[result["wmspec"]][
                    'processing'] = self.processingCount(result)
            else:
                workflow[result["wmspec"]][result["state"]] = result["num_job"]
                workflow[result["wmspec"]]['total_jobs'] += result["num_job"]
                workflow[result["wmspec"]]["real_success"] += int(
                    result["success"])
                workflow[result["wmspec"]]["pending"] += self.pendingCount(
                    result)
                workflow[result["wmspec"]]["real_fail"] += self.failCount(
                    result)
                workflow[result["wmspec"]][
                    'processing'] += self.processingCount(result)

        # need to order by id (client side)
        return workflow.values()