def test_monitor(monkeypatch): cluster_id = uuid.uuid4() assert Stat.get(pid=0, cluster_id=cluster_id).sentinel == 0 c = Cluster() c.start() stats = monitor(run_once=True) assert get_ids() is True c.stop() assert len(stats) > 0 found_c = False for stat in stats: if stat.cluster_id == c.cluster_id: found_c = True assert stat.uptime() > 0 assert stat.empty_queues() is True break assert found_c is True # test lock size monkeypatch.setattr(Conf, 'ORM', 'default') b = get_broker('monitor_test') b.enqueue('test') b.dequeue() assert b.lock_size() == 1 monitor(run_once=True, broker=b) b.delete_queue()
def test_monitor(): c = Cluster() c.start() stats = monitor(run_once=True) c.stop() assert len(stats) > 0 found_c = False for stat in stats: if stat.cluster_id == c.pid: found_c = True break assert found_c is True
def test_monitor(monkeypatch): assert Stat.get(0).sentinel == 0 c = Cluster() c.start() stats = monitor(run_once=True) c.stop() assert len(stats) > 0 found_c = False for stat in stats: if stat.cluster_id == c.pid: found_c = True assert stat.uptime() > 0 assert stat.empty_queues() is True break assert found_c is True # test lock size monkeypatch.setattr(Conf, 'ORM', 'default') b = get_broker('monitor_test') b.enqueue('test') b.dequeue() assert b.lock_size() == 1 monitor(run_once=True, broker=b) b.delete_queue()
def test_monitor(): assert Stat.get(0).sentinel == 0 c = Cluster() c.start() stats = monitor(run_once=True) c.stop() assert len(stats) > 0 found_c = False for stat in stats: if stat.cluster_id == c.pid: found_c = True assert stat.uptime() > 0 assert stat.empty_queues() is True break assert found_c is True
def test_monitor(): assert Stat.get(0).sentinel == 0 c = Cluster() c.start() stats = monitor(run_once=True) c.stop() assert len(stats) > 0 found_c = False for stat in stats: if stat.cluster_id == c.pid: found_c = True assert stat.uptime() > 0 assert stat.empty_queues() is True break assert found_c is True # test lock size Conf.ORM = 'default' b = get_broker('monitor_test') b.enqueue('test') b.dequeue() assert b.lock_size() == 1 monitor(run_once=True, broker=b) b.delete_queue() Conf.ORM = None
def handle(self, *args, **options): monitor(run_once=options.get('run_once', False))
def handle(self, *args, **options): monitor()