Exemplo n.º 1
0
def clean_db():
    with session_scope() as dao_sess:
        stat_call_on_queue_dao.clean_table(dao_sess)
        stat_agent_periodic_dao.clean_table(dao_sess)
        stat_queue_periodic_dao.clean_table(dao_sess)
        stat_agent_dao.clean_table(dao_sess)
        stat_queue_dao.clean_table(dao_sess)
Exemplo n.º 2
0
    def test_clean_table(self):
        queue_name, queue_id = self._insert_queue_to_stat_queue()
        stats = {queue_id: {'full': 4, 'total': 10}}
        period_start = dt(2012, 1, 1, 00, 00, 00, tzinfo=UTC)

        stat_queue_periodic_dao.insert_stats(self.session, stats, period_start)

        stat_queue_periodic_dao.clean_table(self.session)

        total = self.session.query(func.count(StatQueuePeriodic.time))[0][0]

        self.assertEqual(total, 0)
    def test_clean_table(self):
        queue_name, queue_id = self._insert_queue_to_stat_queue()
        stats = {
            queue_id: {
                'full': 4,
                'total': 10
            }
        }
        period_start = datetime.datetime(2012, 01, 01, 00, 00, 00)

        stat_queue_periodic_dao.insert_stats(self.session, stats, period_start)

        stat_queue_periodic_dao.clean_table(self.session)

        total = self.session.query(func.count(StatQueuePeriodic.time))[0][0]

        self.assertEqual(total, 0)
Exemplo n.º 4
0
def clean_db():
    stat_call_on_queue_dao.clean_table(dao_sess)
    stat_agent_periodic_dao.clean_table(dao_sess)
    stat_queue_periodic_dao.clean_table(dao_sess)
    stat_agent_dao.clean_table(dao_sess)
    stat_queue_dao.clean_table(dao_sess)