def run(self):
        pipe = self.input
        count = 0

        for row in pipe.rows():
            logging.debug("sampling row %d" % count)
            if self.method == "random":
                uniform = random.random()
                self.stack.push(key = uniform, value = row)
            elif self.method == "percent":
                if random.random() < float(self.size)/100.:
                    self.put(row)
                    count += 1
            else:
                self.put(row)
                count += 1
                if count >= self.size:
                    break
        # output items remaining in stack
        if self.stack:
            for row in self.stack.items():
                self.put(row)
dataset/ETHPy150Open Stiivi/brewery/brewery/nodes/record_nodes.py/SampleNode.run/original