def _upgrade_reminder_schedule_send(site_id, msg_str): site = Site.objects.get(pk=site_id) if not ScheduleConfig.current(site).deliver_upgrade_reminder: return msg = Message.from_string(msg_str) ace.send(msg)
def _upgrade_reminder_schedule_send(site_id, msg_str): site = Site.objects.get(pk=site_id) if not ScheduleConfig.current(site).deliver_upgrade_reminder: return msg = Message.from_string(msg_str) ace.send(msg)
def _course_update_schedule_send(site_id, msg_str): site = Site.objects.get(pk=site_id) if not ScheduleConfig.current(site).deliver_course_update: return msg = Message.from_string(msg_str) ace.send(msg)
def send(self, day, override_recipient_email=None): """ Send a message to all users whose schedule started at ``self.current_date`` - ``day``. """ if not ScheduleConfig.current(self.site).enqueue_recurring_nudge: return try: site_config = SiteConfiguration.objects.get(site_id=self.site.id) org_list = site_config.values.get('course_org_filter', None) exclude_orgs = False if not org_list: not_orgs = set() for other_site_config in SiteConfiguration.objects.all(): not_orgs.update( other_site_config.values.get('course_org_filter', [])) org_list = list(not_orgs) exclude_orgs = True elif not isinstance(org_list, list): org_list = [org_list] except SiteConfiguration.DoesNotExist: org_list = None exclude_orgs = False target_date = self.current_date - datetime.timedelta(days=day) for hour in range(24): target_hour = target_date + datetime.timedelta(hours=hour) recurring_nudge_schedule_hour.apply_async( (self.site.id, day, serialize(target_hour), org_list, exclude_orgs, override_recipient_email), retry=False, )
def send(self, day, override_recipient_email=None): """ Send a message to all users whose schedule started at ``self.current_date`` - ``day``. """ if not ScheduleConfig.current(self.site).enqueue_recurring_nudge: return try: site_config = SiteConfiguration.objects.get(site_id=self.site.id) org_list = site_config.values.get('course_org_filter', None) exclude_orgs = False if not org_list: not_orgs = set() for other_site_config in SiteConfiguration.objects.all(): not_orgs.update(other_site_config.values.get('course_org_filter', [])) org_list = list(not_orgs) exclude_orgs = True elif not isinstance(org_list, list): org_list = [org_list] except SiteConfiguration.DoesNotExist: org_list = None exclude_orgs = False target_date = self.current_date - datetime.timedelta(days=day) for hour in range(24): target_hour = target_date + datetime.timedelta(hours=hour) recurring_nudge_schedule_hour.apply_async( (self.site.id, day, serialize(target_hour), org_list, exclude_orgs, override_recipient_email), retry=False, )
def _course_update_schedule_send(site_id, msg_str): site = Site.objects.get(pk=site_id) if not ScheduleConfig.current(site).deliver_course_update: return msg = Message.from_string(msg_str) ace.send(msg)
def _recurring_nudge_schedule_send(site_id, msg_str): site = Site.objects.get(pk=site_id) if not ScheduleConfig.current(site).deliver_recurring_nudge: LOG.debug('Recurring Nudge: Message delivery disabled for site %s', site.domain) return msg = Message.from_string(msg_str) LOG.debug('Recurring Nudge: Sending message = %s', msg_str) ace.send(msg)
def _recurring_nudge_schedule_send(site_id, msg_str): site = Site.objects.get(pk=site_id) if not ScheduleConfig.current(site).deliver_recurring_nudge: LOG.debug('Recurring Nudge: Message delivery disabled for site %s', site.domain) return msg = Message.from_string(msg_str) LOG.debug('Recurring Nudge: Sending message = %s', msg_str) ace.send(msg)
def _recurring_nudge_schedule_send(site_id, msg_str): site = Site.objects.get(pk=site_id) if not ScheduleConfig.current(site).deliver_recurring_nudge: LOG.debug('Recurring Nudge: Message delivery disabled for site %s', site.domain) return msg = Message.from_string(msg_str) # A unique identifier for this batch of messages being sent. set_custom_metric('send_uuid', msg.send_uuid) # A unique identifier for this particular message. set_custom_metric('uuid', msg.uuid) LOG.debug('Recurring Nudge: Sending message = %s', msg_str) ace.send(msg)
def _recurring_nudge_schedule_send(site_id, msg_str): site = Site.objects.get(pk=site_id) if not ScheduleConfig.current(site).deliver_recurring_nudge: LOG.debug('Recurring Nudge: Message delivery disabled for site %s', site.domain) return msg = Message.from_string(msg_str) # A unique identifier for this batch of messages being sent. set_custom_metric('send_uuid', msg.send_uuid) # A unique identifier for this particular message. set_custom_metric('uuid', msg.uuid) LOG.debug('Recurring Nudge: Sending message = %s', msg_str) ace.send(msg)
def send(self, day, override_recipient_email=None): """ Send a message to all users whose schedule started at ``self.current_date`` - ``day``. """ if not ScheduleConfig.current(self.site).enqueue_recurring_nudge: LOG.debug('Recurring Nudge: Message queuing disabled for site %s', self.site.domain) return exclude_orgs, org_list = self.get_org_filter() target_date = self.current_date - datetime.timedelta(days=day) LOG.debug('Scheduled Nudge: Target date = %s', target_date.isoformat()) for hour in range(24): target_hour = target_date + datetime.timedelta(hours=hour) task_args = (self.site.id, day, serialize(target_hour), org_list, exclude_orgs, override_recipient_email) LOG.debug('Scheduled Nudge: Launching task with args = %r', task_args) recurring_nudge_schedule_hour.apply_async(task_args, retry=False)
def is_enqueue_enabled(cls, site): if cls.enqueue_config_var: return getattr(ScheduleConfig.current(site), cls.enqueue_config_var) return False
def _is_delivery_enabled(site, delivery_config_var, log_prefix): if getattr(ScheduleConfig.current(site), delivery_config_var, False): return True else: LOG.info('%s: Message delivery disabled for site %s', log_prefix, site.domain)
def is_enqueue_enabled(cls, site): if cls.enqueue_config_var: return getattr(ScheduleConfig.current(site), cls.enqueue_config_var) return False
def _is_delivery_enabled(site, delivery_config_var, log_prefix): if getattr(ScheduleConfig.current(site), delivery_config_var, False): return True else: LOG.debug('%s: Message delivery disabled for site %s', log_prefix, site.domain)
def _is_delivery_enabled(site_id, delivery_config_var, log_prefix): site = Site.objects.get(pk=site_id) if getattr(ScheduleConfig.current(site), delivery_config_var, False): return True else: LOG.debug('%s: Message delivery disabled for site %s', log_prefix, site.domain)
def is_enqueue_enabled(self): if self.enqueue_config_var: return getattr(ScheduleConfig.current(self.site), self.enqueue_config_var) return False
def is_enqueue_enabled(self): if self.enqueue_config_var: return getattr(ScheduleConfig.current(self.site), self.enqueue_config_var) return False