Esempio n. 1
0
 def handle(self, *args, **options):
     if options.get('ids', True):
         get_ids()
     elif options.get('config', False):
         hide = ['conf', 'IDLE', 'STOPPING', 'STARTING', 'WORKING', 'SIGNAL_NAMES', 'STOPPED']
         settings = [a for a in dir(Conf) if not a.startswith('__') and a not in hide]
         self.stdout.write('VERSION: {}'.format('.'.join(str(v) for v in VERSION)))
         for setting in settings:
             value = getattr(Conf, setting)
             if value is not None:
                 self.stdout.write('{}: {}'.format(setting, value))
     else:
         info()
Esempio n. 2
0
 def handle(self, *args, **options):
     if options.get('ids', True):
         get_ids()
     elif options.get('config', False):
         hide = ['conf', 'IDLE', 'STOPPING', 'STARTING', 'WORKING', 'SIGNAL_NAMES', 'STOPPED']
         settings = [a for a in dir(Conf) if not a.startswith('__') and a not in hide]
         self.stdout.write('VERSION: {}'.format('.'.join(str(v) for v in VERSION)))
         for setting in settings:
             value = getattr(Conf, setting)
             if value is not None:
                 self.stdout.write('{}: {}'.format(setting, value))
     else:
         info()
Esempio n. 3
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()
Esempio n. 4
0
 def handle(self, *args, **options):
     if options.get("ids", True):
         get_ids()
     elif options.get("config", False):
         hide = [
             "conf",
             "IDLE",
             "STOPPING",
             "STARTING",
             "WORKING",
             "SIGNAL_NAMES",
             "STOPPED",
         ]
         settings = [
             a for a in dir(Conf) if not a.startswith("__") and a not in hide
         ]
         self.stdout.write(f"VERSION: {'.'.join(str(v) for v in VERSION)}")
         for setting in settings:
             value = getattr(Conf, setting)
             if value is not None:
                 self.stdout.write(f"{setting}: {value}")
     else:
         info()