コード例 #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.')