def __init__(self, name): super(Filesystem, self).__init__() #self.setGeometry(0, 0, 100, 100) self.setMinimumSize(203, 102) self.setMaximumSize(203, 102) self.name = name self.topfs = top.filesystem("localhost",self.name) print name timer = QtCore.QTimer(self) timer.timeout.connect(self.doUpdate) timer.start(1000*INTERVAL) #self.setMouseTracking(True) self.doUpdate() self.selected = False
def __init__(self, filesystem): super(StackedCoordinates, self).__init__() self.W = 1400 self.H = 1000 #self.setMinimumSize(self.W, self.H) self.maxima = [0, 0, 0, 0, 0, 0] self.fsname = filesystem # mouseras contains tuples with y coordinates for jobnames self.mouseareas={} self.mouseareas["nodes"] = {} self.mouseareas["meta"] = {} self.mouseareas["rqs"] = {} self.mouseareas["bw"] = {} self.topfs = top.filesystem("localhost",self.fsname) self.initUI() # start timer for auto update # FIXME move to Window and Update all at once with one timer? timer = QtCore.QTimer(self) timer.timeout.connect(self.doUpdate) timer.start(1000*INTERVAL)
def getJobList(self, N=5): self.fs = top.filesystem(top.DBHOST, self.fsname) (timestamp, nodes) = self.fs.currentNodesstats() jobs = self.fs.mapNodesToJobs(timestamp, nodes) joblist = {} # convert in local format for j in jobs: cj = jobs[j] joblist[j] = Job(j,cj.owner, len(cj.nodelist), cj.miops/INTERVAL, cj.wiops/INTERVAL, cj.wbw/INTERVAL, cj.riops/INTERVAL, cj.rbw/INTERVAL ) totalnodes= 0 totalmeta = 0 totalwrqs = 0 totalrrqs = 0 totalwbw = 0 totalrbw = 0 for j in joblist: totalnodes += joblist[j].nodes totalmeta += joblist[j].meta totalwrqs += joblist[j].wrqs totalrrqs += joblist[j].rrqs totalwbw += joblist[j].wbw totalrbw += joblist[j].rbw totals = (totalnodes, totalmeta, totalwrqs, totalrrqs, totalwbw, totalrbw) # idea: make a list of # N largest nodes # N nodes doing most metadata # N nodes doing most rqs # N nodes doing most BW # if a node is doubled, take next from local list # this summed list will be display (double/dashed line inbetween??) toplist=[] for list in [ sorted(joblist.values(), key=lambda x: x.nodes, reverse=True), sorted(joblist.values(), key=lambda x: x.meta, reverse=True), sorted(joblist.values(), key=lambda x: x.wrqs+x.rrqs, reverse=True), sorted(joblist.values(), key=lambda x: x.wbw+x.rbw, reverse=True), ]: i=0 for j in list: if j not in toplist: toplist.append(j) i+=1 if i>=N: break listnodes=0 for j in toplist: listnodes += j.nodes # sort again, so total list os sorted now according to node number toplist = sorted(toplist, key=lambda x: x.nodes, reverse=True) shares={} for j in toplist: if totalmeta == 0: totalmeta = 1 if (totalwrqs+totalrrqs) == 0: totalrrqs = 1 if (totalwbw+totalrbw) == 0: totalrbw = 1 shares[j.name]={ "name":j.name, "owner": j.owner, # "nodes": float(j.nodes)/totalnodes, "nodes": float(j.nodes)/listnodes, "meta": float(j.meta)/totalmeta, "rqs": float(j.wrqs+j.rrqs)/(totalwrqs+totalrrqs), "bw": float(j.wbw+j.rbw)/(totalwbw+totalrbw) } # get maxima from DB self.maxima = self.fs.readFSMaxima() #print "from db:", self.maxima return (toplist, shares, totals)
def changeFS(self, fsname): self.fsname = fsname self.topfs = top.filesystem("localhost",self.fsname) self.doUpdate()