def configure_worker(instance, **kwargs): from .models import Worker if any([t in get_worker_types() for t in ['mx', 'all']]): from .tasks import send_email # noqa sys.stdout.write('[mailsend-app] Registering worker as MX...') if not settings.MAILSEND.get('SMTP_WORKER_EHLO_AS') or \ not settings.MAILSEND.get('SMTP_WORKER_SRC_ADDR'): raise Exception('Settings must define "SMTP_WORKER_EHLO_AS" ' 'and "SMTP_WORKER_SRC_ADDR"') worker, created = Worker.objects.get_or_create( ip=settings.MAILSEND.get('SMTP_WORKER_SRC_ADDR')) worker.name = kwargs.get('sender') worker.policies_settings = settings.MAILSEND.get( 'WORKER_POLICIES_SETTINGS', {}) worker.enabled = True worker.save() queue = settings.MAILSEND.get('MX_WORKER_QUEUE_PREFIX', '').format(ip=worker.ip) munch_tasks_router.register_to_queue(queue) queue = settings.MAILSEND.get('MX_WORKER_QUEUE_RETRY_PREFIX', '').format(ip=worker.ip) munch_tasks_router.register_to_queue(queue) if any([t in get_worker_types() for t in ['router', 'all']]): from .tasks import route_envelope # noqa sys.stdout.write('[mailsend-app] Registering worker as ROUTER...') munch_tasks_router.register_as_worker('router') if any([t in get_worker_types() for t in ['gc', 'all']]): from .tasks import ping_workers # noqa from .tasks import dispatch_queued # noqa from .tasks import check_disabled_workers # noqa sys.stdout.write( '[mailsend-app] Registering worker as GARBAGE COLLECTOR...') munch_tasks_router.register_as_worker('gc')
def configure_worker(instance, **kwargs): if any([t in get_worker_types() for t in ['status', 'all']]): from .status import create_dsn # noqa from .status import forward_dsn # noqa from .status import send_webhook # noqa from .status import record_status # noqa from .status import handle_dsn_status # noqa from .status import handle_smtp_status # noqa sys.stdout.write('[transactional] Registering worker as STATUS...') munch_tasks_router.register_as_worker('status')
def configure_worker(instance, **kwargs): if any(t in get_worker_types() for t in ['core', 'all']): from .tasks import handle_bounce # noqa from .tasks import handle_bounce_expirations # noqa from .tasks import handle_failed_expirations # noqa from .tasks import handle_opt_ins_expirations # noqa from .tasks import handle_consumed_contacts_expirations # noqa sys.stdout.write('[contacts-app] Registering worker as CORE...') munch_tasks_router.register_as_worker('core')
def configure_worker(instance, **kwargs): worker_types = get_worker_types() if any(t in worker_types for t in ['status', 'all']): from .tasks import handle_dsn # noqa from .tasks import handle_fbl # noqa from .utils import record_status # noqa from .tasks import handle_mail_optout # noqa sys.stdout.write('[campaigns-app] Registering worker as STATUS...') munch_tasks_router.register_as_worker('status') if any(t in worker_types for t in ['core', 'all']): from .tasks import send_mail # noqa sys.stdout.write('[campaigns-app] Registering worker as CORE...') munch_tasks_router.register_as_worker('core')
def configure_worker(instance, **kwargs): if any([t in get_worker_types() for t in ['core', 'all']]): # from .tasks import ... # noqa sys.stdout.write('[users-app] Registering worker as CORE...') munch_tasks_router.register_as_worker('core')
def configure_worker(instance, **kwargs): if any([t in get_worker_types() for t in ['core', 'all']]): from .tasks import create_track_record # noqa sys.stdout.write('[tracking-app] Registering worker as CORE...') munch_tasks_router.register_as_worker('core')
def configure_worker(instance, **kwargs): if any([t in get_worker_types() for t in ['core', 'all']]): from .tasks import run_domains_validation # noqa from .tasks import validate_sending_domain_field # noqa sys.stdout.write('[domains-app] Registering worker as CORE...') munch_tasks_router.register_as_worker('core')