コード例 #1
0
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()
コード例 #2
0
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
コード例 #3
0
ファイル: test_monitor.py プロジェクト: Koed00/django-q
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()
コード例 #4
0
ファイル: test_monitor.py プロジェクト: sebasmagri/django-q
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
コード例 #5
0
ファイル: test_monitor.py プロジェクト: yonglehou/django-q
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
コード例 #6
0
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
コード例 #7
0
ファイル: qmonitor.py プロジェクト: davinirjr/django-q
 def handle(self, *args, **options):
     monitor(run_once=options.get('run_once', False))
コード例 #8
0
 def handle(self, *args, **options):
     monitor(run_once=options.get('run_once', False))
コード例 #9
0
 def handle(self, *args, **options):
     monitor()
コード例 #10
0
ファイル: qmonitor.py プロジェクト: Ankhbayar/django-q
 def handle(self, *args, **options):
     monitor()