示例#1
0
文件: vent.py 项目: gisjedi/caldera
    def handle(self, *args, **options):
        count = options['count']
        start = options['start']
        end = options['end']

        event = Event()
        logger.info('Creating %s events between %s and %s...' % (count, start, end))
        event.generate(count, start, end)
        logger.info('Completed.')
示例#2
0
文件: erupt.py 项目: gisjedi/caldera
    def handle(self, *args, **options):
        global dormant
        count = options['count']
        interval = options['interval']

        signal.signal(signal.SIGINT, signal_handler)

        while running:
            dormant = False
            event = Event()
            past = arrow.utcnow().datetime - timedelta(seconds=interval)
            now = arrow.utcnow().datetime

            logger.info('Creating %s events between %s and %s...' % (count, past, now))
            event.generate(count, past, now)
            dormant = True

            if running:
                # Sleep until the interval has elapsed
                logger.info('Sleeping %s seconds...' % interval)
                sleep(interval)

        logger.info('Complete.')