def getAverageProcessingTimes(self): job = JSONObject() job.name = self.name job.value = self.mean() if len(self.timeElementMap) > 0: job.values = [] for element in self.timeElementMap: if len(self.timeElementMap[element].timeElementMap) > 0: job.values.append(self.timeElementMap[element].getAverageProcessingTimes()) else: job2 = JSONObject() job2.name = element job2.value = self.timeElementMap[element].mean() job.values.append(job2) return job
def valueMapToJson(self, test, joblist, job=None, parent=None): if not parent: keys = [key for key in test if "." not in key] else: parentString = parent + "." keys = [key for key in test if parentString in key] keys = [key for key in keys if "." not in key.split(parentString)[1]] for key in keys: job2 = JSONObject() job2.name = key.split(".")[len(key.split("."))-1] job2.value = test[key] if job: if job.values: job.values.append(job2) else: job.values = [] job.values.append(job2) else: joblist.append(job2) test.pop(key) if len(test) > 0: self.valueMapToJson(test, joblist, job2, key)
def getQualityValues(self, jOb, name, avgQualityType): q = JSONObject() q.absoluteValues = self.qList.get(avgQualityType).absoluteBuffer.items q.ratedValues = self.qList.get(avgQualityType).ratedBuffer.items q.name = name q.unit = self.unit jOb.values.append(q)
def finish(cls): jobs = JSONObject() jobs.stats = [] for e in Stats.instances: job = JSONObject() job.name = e job.value = e.getvalue() jobs.stats.append(job) return jobs
def getAvgQualities(self, jOb, name): for key in self.qList: q = JSONObject() q.absoluteValue = self.qList.get(key).getAbsoluteAverage() q.absoluteValueMin = self.qList.get(key).getAbsoluteMin() q.absoluteValueMax = self.qList.get(key).getAbsoluteMax() q.ratedValue = self.qList.get(key).getRatedAverage() q.ratedValueMin = self.qList.get(key).getRatedMin() q.ratedValueMax = self.qList.get(key).getRatedMax() q.name = name q.unit = self.unit jOb[key].values.append(q)