def _getnoncompletedtable(self, runnode): t = Table() t.hformat = '%-5s | %-10s | %-8s | %-22s | %-22s' t.header = ('Id', 'Status', 'Backend', 'Backend.id', 'ActualCE') t.rformat = '%-5s | %-10s | %-8s | %-22s | %-22s' for corenode in runnode.getnodes('job.core'): if corenode.getvalue('status') != 'completed': t.addrow(corenode.getvalue('id'), corenode.getvalue('status'), corenode.getvalue('backend'), corenode.getvalue('backend-id'), corenode.getvalue('backend-actualCE')) return t
def _getstatustable(self, runnode): t = Table() t.hformat = '%-20s | %8s' t.header = ('Status', 'Subtotal') t.rformat = '%-20s | %8d' statussubtotals = {} # dict {'my-status':subtotal, ...} total = 0 for status in runnode.getvalues('job.core.status'): if not status in statussubtotals: statussubtotals[status] = 0 statussubtotals[status] += 1 total += 1 # add rows ('my-status', subtotal) for (status, subtotal) in statussubtotals.items(): t.addrow(status, subtotal) # add row ('Total', total) t.addrow('Total', total) return t
def _getcetable(self, runnode): t = Table() t.hformat = '%-59s | %9s | %5s' t.header = ('ActualCE', 'Completed', 'Total') t.rformat = '%-59s | %9d | %5d' cestats = {} # dict {'my-ce': (completed, total)} for corenode in runnode.getnodes('job.core'): ce = corenode.getvalue('backend-actualCE') status = corenode.getvalue('status') if not ce in cestats: stats = [0, 0] cestats[ce] = stats else: stats = cestats[ce] if status == 'completed': stats[0] += 1 #increment completed stats[1] += 1 #increment total # add rows ('my-ce', completed, total) for (ce, stats) in cestats.items(): t.addrow(ce, stats[0], stats[1]) return t