def handle(self, *args, **options): from huey.contrib.djhuey import HUEY consumer_options = {} if isinstance(settings.HUEY, dict): consumer_options.update(settings.HUEY.get('consumer', {})) if options['workers'] is not None: consumer_options['workers'] = options['workers'] if options['worker_type'] is not None: consumer_options['worker_type'] = options['worker_type'] if options['periodic'] is not None: consumer_options['periodic'] = options['periodic'] if options['initial_delay'] is not None: consumer_options['initial_delay'] = options['initial_delay'] if options['max_delay'] is not None: consumer_options['max_delay'] = options['max_delay'] self.autodiscover() loglevel = get_loglevel(consumer_options.pop('loglevel', None)) logfile = consumer_options.pop('logfile', None) setup_logger(loglevel, logfile, consumer_options['worker_type']) consumer = Consumer(HUEY, **consumer_options) consumer.run()
def handle(self, *args, **options): from huey.djhuey import HUEY try: consumer_options = settings.HUEY['consumer_options'] except: consumer_options = {} if options['workers'] is not None: consumer_options['workers'] = options['workers'] if options['periodic'] is not None: consumer_options['periodic'] = options['periodic'] if options['initial_delay'] is not None: consumer_options['initial_delay'] = options['initial_delay'] if options['max_delay'] is not None: consumer_options['max_delay'] = options['max_delay'] self.autodiscover() loglevel = get_loglevel(consumer_options.pop('loglevel', None)) logfile = consumer_options.pop('logfile', None) setup_logger(loglevel, logfile) consumer = Consumer(HUEY, **consumer_options) consumer.run()