示例#1
0
def async_send_admin_email(subject, body):
    async = str2bool(os.getenv('ASYNC_TASKS', True))
    if async:
        queue = connect_redis.default_queue()
        queue.enqueue(send_admin_email, subject, body)
        logging.info('Sending admin email %s' % subject)
    else:
        send_admin_email(subject, body)
示例#2
0
def async_send_admin_email(subject, body):
    async = str2bool(os.getenv('ASYNC_TASKS', True))
    if async:
        queue = connect_redis.default_queue()
        queue.enqueue(send_admin_email, subject, body)
        logging.info('Sending admin email %s' % subject)
    else:
        send_admin_email(subject, body)
示例#3
0
def async_tweet(msg):
    test_mode = str2bool(os.getenv('TEST_MODE', False))
    if test_mode:
        logging.info('Tweeting {msg}'.format(msg=msg))
    else:
        async = str2bool(os.getenv('ASYNC_TASKS', True))
        if async:
            queue = connect_redis.default_queue()
            queue.enqueue(tweet, msg)
            logging.info('Tweeting %s' % msg)
        else:
            tweet(msg)
示例#4
0
def async_tweet(msg):
    test_mode = str2bool(os.getenv('TEST_MODE', False))
    if test_mode:
        logging.info('Tweeting {msg}'.format(msg=msg))
    else:
        async = str2bool(os.getenv('ASYNC_TASKS', True))
        if async:
            queue = connect_redis.default_queue()
            queue.enqueue(tweet, msg)
            logging.info('Tweeting %s' % msg)
        else:
            tweet(msg)
 def add_contact_to_propagation(self, fb_id=None, tags=None, languages=None):
     import connect_redis # import to connect to redis
     from apps.utils.tasks import add_contact_to_propagation
     queue = connect_redis.default_queue()
     queue.enqueue(add_contact_to_propagation, email=self.email, fb_id=fb_id, tags=tags, languages=languages)
 def update_country(self, ip):
     import connect_redis # import to connect to redis
     from .tasks import update_country
     queue = connect_redis.default_queue()
     queue.enqueue(update_country, self.id, ip)
 def async_task(self):
     queue = connect_redis.default_queue()
     queue.enqueue_call(func='apps.app.tasks.a_task', args=(None,))
 def async_task(self):
     queue = connect_redis.default_queue()
     queue.enqueue_call(func='apps.app.tasks.a_task', args=(None, ))