def getClusterStat(bucket, stat): val = 0 clusterStatus = CacheHelper.clusterstatus(cfg.CB_CLUSTER_TAG+"_status") or\ ClusterStatus() host = clusterStatus.get_random_host() stat_checker = phandler.BucketStatChecker(bucket, addr=host) stats = stat_checker.get_stats() if len(stats) > 0: if stat in stats: val = stats[stat] return val
def setupPostconditionHandler(self): if self.postconditions: stat, cmp_type, value = \ phandler.default_condition_params(self.postconditions) if stat == 'count': stat_checker = phandler.BucketStatChecker(self.bucket) curr_items = stat_checker.get_curr_items() value = int(value) + int(curr_items) self.postconditions = "curr_items >= %s" % value # setup postcondition hander self.postcondition_handler =\ phandler.getPostConditionMethod(self)