def ensure_migration_flag_disabled(self, domain): while REMINDERS_MIGRATION_IN_PROGRESS.enabled(domain): moves.input( "Please disable REMINDERS_MIGRATION_IN_PROGRESS for '%s' and hit enter..." % domain) log("REMINDERS_MIGRATION_IN_PROGRESS disabled for %s" % domain)
def _assert_no_migration_restrictions(self, domain_name): assert should_use_sql_backend(domain_name) assert not COUCH_SQL_MIGRATION_BLACKLIST.enabled( domain_name, NAMESPACE_DOMAIN) assert not any( custom_report_domain == domain_name for custom_report_domain in settings.DOMAIN_MODULE_MAP.keys()) assert not REMINDERS_MIGRATION_IN_PROGRESS.enabled(domain_name)
def sync_case_for_messaging(self, domain, case_id): if REMINDERS_MIGRATION_IN_PROGRESS.enabled(domain): sync_case_for_messaging.apply_async([domain, case_id], countdown=60) return try: with CriticalSection([get_sync_key(case_id)], timeout=5 * 60): _sync_case_for_messaging(domain, case_id) except Exception as e: self.retry(exc=e)
def sync_case_for_messaging(self, domain, case_id): if REMINDERS_MIGRATION_IN_PROGRESS.enabled(domain): sync_case_for_messaging.apply_async([domain, case_id], countdown=60) return try: with CriticalSection([get_sync_key(case_id)], timeout=5 * 60): _sync_case_for_messaging(domain, case_id) except Exception as e: self.retry(exc=e)
def _check_for_migration_restrictions(self, domain_name): if not should_use_sql_backend(domain_name): msg = "does not have SQL backend enabled" elif COUCH_SQL_MIGRATION_BLACKLIST.enabled(domain_name, NAMESPACE_DOMAIN): msg = "is blacklisted" elif any(custom_report_domain == domain_name for custom_report_domain in settings.DOMAIN_MODULE_MAP.keys()): msg = "has custom reports" elif REMINDERS_MIGRATION_IN_PROGRESS.enabled(domain_name): msg = "has reminders migration in progress" else: return raise MigrationRestricted("{} {}".format(domain_name, msg))
def fire_reminder(reminder_id, domain): if REMINDERS_MIGRATION_IN_PROGRESS.enabled(domain): fire_reminder.apply_async([reminder_id, domain], countdown=60) return try: if settings.ENTERPRISE_MODE or reminder_rate_limiter.can_perform_action( domain): _fire_reminder(reminder_id) else: fire_reminder.apply_async(args=[reminder_id, domain], countdown=60) except Exception: notify_exception(None, message="Error firing reminder %s" % reminder_id)
def skip_domain(domain): return (any_migrations_in_progress(domain) or REMINDERS_MIGRATION_IN_PROGRESS.enabled(domain))
def _assert_no_migration_restrictions(self, domain_name): assert should_use_sql_backend(domain_name) assert not COUCH_SQL_MIGRATION_BLACKLIST.enabled(domain_name, NAMESPACE_DOMAIN) assert not any(custom_report_domain == domain_name for custom_report_domain in settings.DOMAIN_MODULE_MAP.keys()) assert not REMINDERS_MIGRATION_IN_PROGRESS.enabled(domain_name)
def skip_domain(domain): return ( any_migrations_in_progress(domain) or REMINDERS_MIGRATION_IN_PROGRESS.enabled(domain) )