示例#1
0
文件: run.py 项目: dolphin93/zjobs
    def run_housekeeper(cls):
        logger.info('start running housekeeper..')
        logger.info('start removing records older than %s days..' % config.HOUSEKEEPING_RECORD_ORDLER_THAN)
        JobItem.remove_old_records(retention_days=config.HOUSEKEEPING_RECORD_ORDLER_THAN)
        logger.info('done removing records older than %s days..' % config.HOUSEKEEPING_RECORD_ORDLER_THAN)

        logger.info('start removing records posted by blocked contacts..')
        JobItem.remove_blocked_records()
        logger.info('done removing records posted by blocked contacts..')

        logger.info('start removing records should have been rejected..')
        JobItem.remove_records_matches_rejection_pattern()
        logger.info('done removing records should have been rejected..')

        logger.info('done running housekeeper..')
示例#2
0
    def run_housekeeper(cls):
        logger.info('start running housekeeper..')
        logger.info('start removing records older than %s days..' %
                    config.HOUSEKEEPING_RECORD_ORDLER_THAN)
        JobItem.remove_old_records(
            retention_days=config.HOUSEKEEPING_RECORD_ORDLER_THAN)
        logger.info('done removing records older than %s days..' %
                    config.HOUSEKEEPING_RECORD_ORDLER_THAN)

        logger.info('start removing records posted by blocked contacts..')
        JobItem.remove_blocked_records()
        logger.info('done removing records posted by blocked contacts..')

        logger.info('start removing records should have been rejected..')
        JobItem.remove_records_matches_rejection_pattern()
        logger.info('done removing records should have been rejected..')

        logger.info('done running housekeeper..')
示例#3
0
文件: tests.py 项目: peisam/zjobs
    def test_remove_blocked_records(self):
        for i in range(0, 20):
            job_item = JobItem()
            job_item.job_title = u"人员_%d" % i
            job_item.contact = str(random.randint(90000000, 99999999))
            job_item.save()

            # mark the contact as blocked
            BlockedContact(job_item.contact, u"人员").save()

        # run the remove action
        JobItem.remove_blocked_records()

        conn = self.connect_db()
        try:
            c = conn.cursor()
            c.execute("SELECT COUNT(*) FROM " + JobItem.table_name)
            self.assertEqual(c.fetchone()[0], 0, "Count of job items should be 0")
        except:
            pass
        finally:
            conn.close()
示例#4
0
文件: tests.py 项目: noushadali/zjobs
    def test_remove_blocked_records(self):
        for i in range(0, 20):
            job_item = JobItem()
            job_item.job_title=u'人员_%d' % i
            job_item.contact = str(random.randint(90000000, 99999999))
            job_item.save()

            # mark the contact as blocked
            BlockedContact(job_item.contact, u'人员').save()

        # run the remove action
        JobItem.remove_blocked_records()

        conn = self.connect_db()
        try:
            c = conn.cursor()
            c.execute('SELECT COUNT(*) FROM ' + JobItem.table_name)
            self.assertEqual(c.fetchone()[0], 0, 'Count of job items should be 0')
        except:
            pass
        finally:
            conn.close()