python - DJANGO Celery on Application Server + Mail server -


I am trying to configure DNAGOS + cialari on an aper server with different mail servers.

Both servers share the same files:

app_name / settings.py

  BROKER_URL = "SQS: //% s:% s @" (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) CELERY_TIMEZONE = 'America /': {'Queue': 'Scheduler' New_York 'CELERY_ACCEPT_CONTENT = [' Pickle ',' json ',' msgpack ',' yamail '] mail.tasks.send_reminder_email_end_user celery.schedules crontab import datetime import timedelta CELERY_ROUTES = { '}' mail.tasks.send_all_daily_new_user_email ': {' queue '' scheduler '},' mail.tasks.send_notification_email ': {' queue '' scheduler '},' mail. Taskss.send_new_post_daily_email ': {' queue ':' scheduler '},' insightstat Tasks. {'Work': 'mail.tasks.send_reminder_email_end_user', 'schedule': crontab (minutes = 0, hours = '' '': '' ' 7)}, 'update_stats_history_daily': { 'work': 'InsightStatktasksksave_stats_history_daily', 'schedule': Crontab (min = 0, h = 1)}, 'send_notification_email_weekly': { 'action': 'Mailktasks Ksend_notification_email ',' schedule ': Crontab (min = 0, h = 8)},' send_digest_email_daily ': {' work ':' Mailktasksksend_new_post_daily_email ',' schedule ': crontab (min = 0, h = 8 )}, 'Send_daily_new_users': {'Work': 'mail.tasks.send_all_daily_new_user_email', 'Schedule': Crontab (min = 0, h = 7)}, 'send_digest_email_weekly': { 'action': 'Mailktasksksend_weekly_digest', 'schedule': Crontabab (min = 0, h = 8, Din_of_viak = 'mon')} }} /  

mail / tasks.py file:

  @shared_task (queue = 'scheduler') def send_all_daily_new_user_email (): apps = application obj ects Kall () for application in apps: daily_new_user_email.delay (app) @shared_task (line = 'daily_user') def daily_new_user_email (app): not print app.digest_email "daily_new_user_email send" Print "application digest is closed, return "Return if not app.owne R.all (): back tomorrow = date.today () - Timeliness (day = 1) users = app.appuser.filter (created_at__gt = tomorrow) users_count = users.count () owner = app Owner_all =) 0: print " No new user for% s "% owner.email return_user = users [0] topic ="% s new member "% str (users_count) content_html = render_to_string ('Daily_new_users.html', local ()) email = owner. Email Print Send Email (NOTIFICATION_EMAIL, Email, Subject, Content_Html, content_html, 'daily_new_users')  

The app_name / celery_task.py file contains:

  app = Silri ( 'Api_nam' backend = 'broker =' "sqs: //% s:% s @"% (AWS_ACCESS_KEY_ID, Adblyues_si) CRET_ACCESS_KEY) ', includes = [' mail.tasks']) If __name__ == '__main__': app.start () # Using the string here means that the worker must not object while using # objects. Config_frame_taizex ('Django Configuration.') app. Autodiscover_task (lambda: settings .INSTLADAPPS)  

Where: Scheduler is a queue on an application server and there is a quote on daily_user mail server. I am using supervisor to start celery staff

This is sending mail to the user many times. Am I doing wrong here?

In addition, can anyone summarize about @shared_task?


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -