def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        # Logger already setup by config, just get an instance
        logger = logging.getLogger('eventgen')
        from eventgenconfig import EventgenAdapter
        adapter = EventgenAdapter(logger, {'module': 'WeblogGenerator', 'sample': sample.name})
        globals()['logger'] = adapter

        from eventgenconfig import Config
        globals()['c'] = Config()

        f = open('tests/perf/weblog/external_ips.sample')
        self.external_ips = [x.strip() for x in f.readlines()]
        self.external_ips_len = len(self.external_ips)
        f.close()

        f = open('tests/perf/weblog/webhosts.sample')
        self.webhosts = [x.strip() for x in f.readlines()]
        f.close()
        self.webhosts_len = len(self.webhosts)

        f = open('tests/perf/weblog/useragents.sample')
        self.useragents = [x.strip() for x in f.readlines()]
        f.close()
        self.useragents_len = len(self.useragents)

        f = open('tests/perf/weblog/webserverstatus.sample')
        self.webserverstatus = [x.strip() for x in f.readlines()]
        f.close()
        self.webserverstatus_len = len(self.webserverstatus)
Example #2
0
    def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        # Logger already setup by config, just get an instance
        logger = logging.getLogger('eventgen')
        from eventgenconfig import EventgenAdapter
        adapter = EventgenAdapter(logger, {'module': 'WeblogGenerator', 'sample': sample.name})
        globals()['logger'] = adapter

        from eventgenconfig import Config
        globals()['c'] = Config()

        f = open('tests/perf/weblog/external_ips.sample')
        self.external_ips = [x.strip() for x in f.readlines()]
        self.external_ips_len = len(self.external_ips)
        f.close()

        f = open('tests/perf/weblog/webhosts.sample')
        self.webhosts = [x.strip() for x in f.readlines()]
        f.close()
        self.webhosts_len = len(self.webhosts)

        f = open('tests/perf/weblog/useragents.sample')
        self.useragents = [x.strip() for x in f.readlines()]
        f.close()
        self.useragents_len = len(self.useragents)

        f = open('tests/perf/weblog/webserverstatus.sample')
        self.webserverstatus = [x.strip() for x in f.readlines()]
        f.close()
        self.webserverstatus_len = len(self.webserverstatus)
Example #3
0
 def __init__(self, sample):
     GeneratorPlugin.__init__(self, sample)
     # Logger already setup by config, just get an instance
     logger = logging.getLogger('eventgen')
     globals()['logger'] = logger
     from eventgenconfig import Config
     globals()['c'] = Config()
Example #4
0
 def __init__(self, sample):
     GeneratorPlugin.__init__(self, sample)
     # Logger already setup by config, just get an instance
     logger = logging.getLogger('eventgen')
     globals()['logger'] = logger
     from eventgenconfig import Config
     globals()['c'] = Config()
Example #5
0
 def __init__(self, sample):
     GeneratorPlugin.__init__(self, sample)
     self.current_count = 0
     self.target_count = 0
     self.earliest = None
     self.latest = None
     self.jinja_count_type = "cycles"
     self.end_of_cycle = False
Example #6
0
 def __init__(self, sample):
     GeneratorPlugin.__init__(self, sample)
     self.current_count = 0
     self.target_count = 0
     self.earliest = None
     self.latest = None
     self.jinja_count_type = "cycles"
     self.end_of_cycle = False
Example #7
0
    def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        self._sample = sample

        # Logger already setup by config, just get an instance
        logger = logging.getLogger('eventgen')
        from eventgenconfig import EventgenAdapter
        adapter = EventgenAdapter(logger, {'module': 'ReplayGenerator', 'sample': sample.name})
        globals()['logger'] = adapter

        from eventgenconfig import Config
        globals()['c'] = Config()

        self._currentevent = 0
        self._timeSinceSleep = datetime.timedelta()
        self._times = [ ]

        s = self._sample

        # Load sample from a file, using cache if possible, from superclass GeneratorPlugin
        s.loadSample()
        self._rpevents = s.sampleDict
        self._currentevent = 0

        # 8/18/15 CS Because this is not a queueable plugin, we can in a threadsafe way modify these data structures at init
        # Iterate through events and remove any events which do not match a configured timestamp,
        # log it and then continue on
        for e in self._rpevents:
            try:
                s.getTSFromEvent(e[s.timeField])
            except ValueError:
                self._rpevents = [x for x in self._rpevents if x['_raw'] != e['_raw']]

        # Quick check to see if we're sorted in time order, if not reverse
        if len(self._rpevents) > 1:
            ts1 = s.getTSFromEvent(self._rpevents[0][s.timeField])
            ts2 = s.getTSFromEvent(self._rpevents[1][s.timeField])
            td = ts2 - ts1
            x = 2
            # Make sure we're not all zero
            while td.days == 0 and td.seconds == 0 and td.microseconds == 0 and x < len(self._rpevents):
                ts2 = s.getTSFromEvent(self._rpevents[x][s.timeField])
                td = ts2 - ts1
                x += 1

            self.logger.debug("Testing timestamps ts1: %s ts2: %s" % (ts1.strftime('%Y-%m-%d %H:%M:%S'), ts2.strftime('%Y-%m-%d %H:%M:%S')))

            if td.days < 0:
                self.logger.debug("Timestamp order seems to be reverse chronological, reversing")
                self._rpevents.reverse()

        try:
            self.setupBackfill()
        except ValueError as e:
            self.logger.error("Exception during backfill for sample '%s': '%s'" % (s.name, str(e)))
Example #8
0
    def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        # Logger already setup by config, just get an instance
        logger = logging.getLogger('eventgen')
        from eventgenconfig import EventgenAdapter
        adapter = EventgenAdapter(logger, {'module': 'WindbagGenerator', 'sample': sample.name})
        globals()['logger'] = adapter

        from eventgenconfig import Config
        globals()['c'] = Config()
    def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        # Logger already setup by config, just get an instance
        logger = logging.getLogger('eventgen')
        from eventgenconfig import EventgenAdapter
        adapter = EventgenAdapter(logger, {'module': 'PerDayVolumeGenerator', 'sample': sample.name})
        globals()['logger'] = adapter

        from eventgenconfig import Config
        globals()['c'] = Config()
Example #10
0
    def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        f = open('tests/perf/weblog/external_ips.sample')
        self.external_ips = [x.strip() for x in f.readlines()]
        self.external_ips_len = len(self.external_ips)
        f.close()

        f = open('tests/perf/weblog/webhosts.sample')
        self.webhosts = [x.strip() for x in f.readlines()]
        f.close()
        self.webhosts_len = len(self.webhosts)

        f = open('tests/perf/weblog/useragents.sample')
        self.useragents = [x.strip() for x in f.readlines()]
        f.close()
        self.useragents_len = len(self.useragents)

        f = open('tests/perf/weblog/webserverstatus.sample')
        self.webserverstatus = [x.strip() for x in f.readlines()]
        f.close()
        self.webserverstatus_len = len(self.webserverstatus)
Example #11
0
    def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        f = open('tests/sample_eventgen_conf/perf/weblog/external_ips.sample')
        self.external_ips = [x.strip() for x in f.readlines()]
        self.external_ips_len = len(self.external_ips)
        f.close()

        f = open('tests/sample_eventgen_conf/perf/weblog/webhosts.sample')
        self.webhosts = [x.strip() for x in f.readlines()]
        f.close()
        self.webhosts_len = len(self.webhosts)

        f = open('tests/sample_eventgen_conf/perf/weblog/useragents.sample')
        self.useragents = [x.strip() for x in f.readlines()]
        f.close()
        self.useragents_len = len(self.useragents)

        f = open('tests/sample_eventgen_conf/perf/weblog/webserverstatus.sample')
        self.webserverstatus = [x.strip() for x in f.readlines()]
        f.close()
        self.webserverstatus_len = len(self.webserverstatus)
Example #12
0
    def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        self._currentevent = 0
        self._timeSinceSleep = datetime.timedelta()
        self._times = []
Example #13
0
 def __init__(self, sample):
     GeneratorPlugin.__init__(self, sample)
Example #14
0
 def __init__(self, sample):
     GeneratorPlugin.__init__(self, sample)
Example #15
0
    def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        self._currentevent = 0
        self._timeSinceSleep = datetime.timedelta()
        self._times = []
Example #16
0
    def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        # Logger already setup by config, just get an instance
        logger = logging.getLogger('eventgen')
        from eventgenconfig import EventgenAdapter
        adapter = EventgenAdapter(logger, {'module': 'WindbagGenerator', 'sample': sample.name})
        globals()['logger'] = adapter

        from eventgenconfig import Config
        globals()['c'] = Config()

        # Pull customers into a dictionary
        fh = open(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'samples', 'customer_master.sample'), 'r')
        # fh = open('../samples/customer_master.sample', 'r')
        self.customers = [ ]
        csvReader = csv.DictReader(fh)
        for line in csvReader:
            newline = dict((k, line[k]) for k in ('Address', 'Age', 'Sex', 'accountNumber', 'customerCity', 'customerMDN', 'customerState', 'customerZip', 'firstName', 'lastName'))
            newline['address'] = newline['Address']
            del newline['Address']
            newline['age'] = newline['Age']
            del newline['Age']
            newline['sex'] = newline['Sex']
            del newline['Sex']
            newline['city'] = newline['customerCity']
            del newline['customerCity']
            newline['phone'] = newline['customerMDN']
            del newline['customerMDN']
            newline['state'] = newline['customerState']
            del newline['customerState']
            newline['zip'] = newline['customerZip']
            del newline['customerZip']
            self.customers.append(newline)

        # Bring items into a dictionary
        fh = open(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'samples', 'items.sample'), 'r')
        self.items = [ ]
        csvReader = csv.reader(fh)
        for line in csvReader:
            self.items.append({ 'category': line[0], 'itemid': line[1], 'description': line[2], 'price': float(line[3]) })

        self.transType = [ 'purchase', 'purchase', 'purchase', 'purchase', 'purchase', 'purchase', 'sale' ]
        self.characterType = [ 'Milk Maid', 'Masked Mouse', 'Curd Cobbler', 'Whey Warrior', 'Fermented Friar' ]
        self.regions = ['Gorgonzolia', 'Camemberalot', 'Jarlsberg', 'Swiss Alps', 'Limburgerland' ]
        self.servers = [ ]
        for a in ['ace', 'bubbles', 'cupcake', 'dash']:
            for b in xrange(0, random.randint(1, 12)):
                self.servers.append('%s.%s.woc.com' % (a, b))

        self.typeRate = { 'purchase': 1.0, 'sale': 0.2 }
        self.maxItems = 12
        self.tps = 5.0


        self.customerslen = len(self.customers)
        self.itemslen = len(self.items)
        self.transtypelen = len(self.transType)
        self.charactertypelen = len(self.characterType)
        self.serverslen = len(self.servers)
        self.regionslen = len(self.regions)
Example #17
0
    def __init__(self, sample):
        GeneratorPlugin.__init__(self, sample)

        # Logger already setup by config, just get an instance
        logger = logging.getLogger('eventgen')
        from eventgenconfig import EventgenAdapter
        adapter = EventgenAdapter(logger, {
            'module': 'WindbagGenerator',
            'sample': sample.name
        })
        globals()['logger'] = adapter

        from eventgenconfig import Config
        globals()['c'] = Config()

        # Pull customers into a dictionary
        fh = open(
            os.path.join(
                os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
                'samples', 'customer_master.sample'), 'r')
        # fh = open('../samples/customer_master.sample', 'r')
        self.customers = []
        csvReader = csv.DictReader(fh)
        for line in csvReader:
            newline = dict(
                (k, line[k])
                for k in ('Address', 'Age', 'Sex', 'accountNumber',
                          'customerCity', 'customerMDN', 'customerState',
                          'customerZip', 'firstName', 'lastName'))
            newline['address'] = newline['Address']
            del newline['Address']
            newline['age'] = newline['Age']
            del newline['Age']
            newline['sex'] = newline['Sex']
            del newline['Sex']
            newline['city'] = newline['customerCity']
            del newline['customerCity']
            newline['phone'] = newline['customerMDN']
            del newline['customerMDN']
            newline['state'] = newline['customerState']
            del newline['customerState']
            newline['zip'] = newline['customerZip']
            del newline['customerZip']
            self.customers.append(newline)

        # Bring items into a dictionary
        fh = open(
            os.path.join(
                os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
                'samples', 'items.sample'), 'r')
        self.items = []
        csvReader = csv.reader(fh)
        for line in csvReader:
            self.items.append({
                'category': line[0],
                'itemid': line[1],
                'description': line[2],
                'price': float(line[3])
            })

        self.transType = [
            'purchase', 'purchase', 'purchase', 'purchase', 'purchase',
            'purchase', 'sale'
        ]
        self.characterType = [
            'Milk Maid', 'Masked Mouse', 'Curd Cobbler', 'Whey Warrior',
            'Fermented Friar'
        ]
        self.regions = [
            'Gorgonzolia', 'Camemberalot', 'Jarlsberg', 'Swiss Alps',
            'Limburgerland'
        ]
        self.servers = []
        for a in ['ace', 'bubbles', 'cupcake', 'dash']:
            for b in xrange(0, random.randint(1, 12)):
                self.servers.append('%s.%s.woc.com' % (a, b))

        self.typeRate = {'purchase': 1.0, 'sale': 0.2}
        self.maxItems = 12
        self.tps = 5.0

        self.customerslen = len(self.customers)
        self.itemslen = len(self.items)
        self.transtypelen = len(self.transType)
        self.charactertypelen = len(self.characterType)
        self.serverslen = len(self.servers)
        self.regionslen = len(self.regions)