def run_celeryev(
    dump=False,
    camera=None,
    frequency=1.0,
    maxrate=None,
    loglevel=logging.WARNING,
    logfile=None,
    prog_name="celeryev",
    **kwargs
):
    if dump:
        from celery.events.dumper import evdump

        set_process_status("%s:dump" % prog_name)
        return evdump()
    if camera:
        from celery.events.snapshot import evcam

        set_process_status("%s:cam" % prog_name)
        return evcam(camera, frequency, maxrate, loglevel=loglevel, logfile=logfile)

    from celery.events.cursesmon import evtop

    set_process_status("%s:top" % prog_name)
    return evtop()
Exemplo n.º 2
0
def run_celeryev(dump=False, camera=None, frequency=1.0, maxrate=None,
        loglevel=logging.WARNING, logfile=None, **kwargs):
    if dump:
        return evdump()
    if camera:
        return evcam(camera, frequency, maxrate,
                     loglevel=loglevel, logfile=logfile)
    return evtop()
Exemplo n.º 3
0
    def test_evdump_error_handler(self):
        app = Mock(name='app')
        with patch('celery.events.dumper.Dumper') as Dumper:
            Dumper.return_value = Mock(name='dumper')
            recv = app.events.Receiver.return_value = Mock()

            def se(*_a, **_k):
                recv.capture.side_effect = SystemExit()
                raise KeyError()
            recv.capture.side_effect = se

            Conn = app.connection_for_read.return_value = Mock(name='conn')
            conn = Conn.clone.return_value = Mock(name='cloned_conn')
            conn.connection_errors = (KeyError,)
            conn.channel_errors = ()

            evdump(app)
            conn.ensure_connection.assert_called()
            errback = conn.ensure_connection.call_args[0][0]
            errback(KeyError(), 1)
            conn.as_uri.assert_called()
Exemplo n.º 4
0
def run_celeryev(dump=False, camera=None, frequency=1.0, maxrate=None,
        loglevel=logging.WARNING, logfile=None, prog_name="celeryev",
        **kwargs):
    if dump:
        set_process_status("%s:dump" % prog_name)
        return evdump()
    if camera:
        set_process_status("%s:cam" % prog_name)
        return evcam(camera, frequency, maxrate,
                     loglevel=loglevel, logfile=logfile)
    set_process_status("%s:top" % prog_name)
    return evtop()
Exemplo n.º 5
0
def run_celeryev(dump=False,
                 camera=None,
                 frequency=1.0,
                 maxrate=None,
                 loglevel=logging.WARNING,
                 logfile=None,
                 prog_name="celeryev",
                 **kwargs):
    if dump:
        set_process_status("%s:dump" % prog_name)
        return evdump()
    if camera:
        set_process_status("%s:cam" % prog_name)
        return evcam(camera,
                     frequency,
                     maxrate,
                     loglevel=loglevel,
                     logfile=logfile)
    set_process_status("%s:top" % prog_name)
    return evtop()
Exemplo n.º 6
0
def run_celeryev(dump=False,
                 camera=None,
                 frequency=1.0,
                 maxrate=None,
                 loglevel=logging.WARNING,
                 logfile=None,
                 prog_name="celeryev",
                 **kwargs):
    if dump:
        from celery.events.dumper import evdump
        set_process_status("%s:dump" % prog_name)
        return evdump()
    if camera:
        from celery.events.snapshot import evcam
        set_process_status("%s:cam" % prog_name)
        return evcam(camera,
                     frequency,
                     maxrate,
                     loglevel=loglevel,
                     logfile=logfile)

    from celery.events.cursesmon import evtop
    set_process_status("%s:top" % prog_name)
    return evtop()
Exemplo n.º 7
0
 def run_evdump(self):
     from celery.events.dumper import evdump
     self.set_process_status('dump')
     return evdump(app=self.app)
Exemplo n.º 8
0
 def test_evdump(self, capture):
     capture.side_effect = KeyboardInterrupt()
     evdump(app=self.app)
Exemplo n.º 9
0
def _run_evdump(app):
    from celery.events.dumper import evdump
    _set_process_status('dump')
    return evdump(app=app)
Exemplo n.º 10
0
 def test_evdump(self, capture):
     evdump()
     capture.side_effect = KeyboardInterrupt()
     evdump()
Exemplo n.º 11
0
 def test_evdump(self, capture):
     evdump()
     capture.side_effect = KeyboardInterrupt()
     evdump()