def update_all_packages(cls): packages = cls.query.filter( or_(cls.last_check <= datetime.utcnow() - timedelta(days=1), cls.last_check == None)).all() for package in packages: with ignored(Exception): package.update_from_pypi() db.session.commit()
def send_emails(cls): users = cls.query.filter( or_(cls.email_sent_at <= datetime.utcnow() - timedelta(days=7), cls.email_sent_at == None)).all() for user in users: with ignored(Exception): logger.info(user) user.send_email() user.email_sent_at = datetime.utcnow() db.session.commit()
def update_all_packages(cls): packages = cls.query.filter( or_( cls.last_check <= datetime.utcnow() - timedelta(days=1), cls.last_check == None ) ).all() for package in packages: with ignored(Exception): package.update_from_pypi() db.session.commit()
def send_emails(cls): users = cls.query.filter( or_( cls.email_sent_at <= datetime.utcnow() - timedelta(days=7), cls.email_sent_at == None ) ).all() for user in users: with ignored(Exception): logger.info(user) user.send_email() user.email_sent_at = datetime.utcnow() db.session.commit()
def update_all_repos(cls): repos = cls.query.all() for repo in repos: with ignored(Exception): repo.update_requirements() db.session.commit()