Example #1
0
 def run_evcam(self,
               camera,
               logfile=None,
               pidfile=None,
               uid=None,
               gid=None,
               umask=None,
               working_directory=None,
               detach=False,
               **kwargs):
     from celery.events.snapshot import evcam
     self.set_process_status("cam")
     kwargs["app"] = self.app
     if not detach:
         return evcam(camera, logfile=logfile, pidfile=pidfile, **kwargs)
     context, on_stop = create_daemon_context(
         logfile=logfile,
         pidfile=pidfile,
         uid=uid,
         gid=gid,
         umask=umask,
         working_directory=working_directory)
     context.open()
     try:
         return evcam(camera, logfile=logfile, pidfile=pidfile, **kwargs)
     finally:
         on_stop()
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()
Example #3
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()
Example #4
0
 def run_evcam(self, camera, logfile=None, pidfile=None, uid=None,
         gid=None, umask=None, working_directory=None,
         detach=False, **kwargs):
     from celery.events.snapshot import evcam
     self.set_process_status("cam")
     kwargs["app"] = self.app
     if not detach:
         return evcam(camera, logfile=logfile, **kwargs)
     context, on_stop = create_daemon_context(
                             logfile=logfile,
                             pidfile=pidfile,
                             uid=uid,
                             gid=gid,
                             umask=umask,
                             working_directory=working_directory)
     context.open()
     try:
         return evcam(camera, logfile=logfile, **kwargs)
     finally:
         on_stop()
Example #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()
Example #6
0
 def test_evcam(self):
     evcam(Polaroid, timer=timer, app=self.app)
     evcam(Polaroid, timer=timer, loglevel='CRITICAL', app=self.app)
     self.MockReceiver.raise_keyboard_interrupt = True
     try:
         with pytest.raises(SystemExit):
             evcam(Polaroid, timer=timer, app=self.app)
     finally:
         self.MockReceiver.raise_keyboard_interrupt = False
Example #7
0
 def test_evcam(self):
     evcam(Polaroid, timer=timer)
     evcam(Polaroid, timer=timer, loglevel="CRITICAL")
     self.MockReceiver.raise_keyboard_interrupt = True
     try:
         with self.assertRaises(SystemExit):
             evcam(Polaroid, timer=timer)
     finally:
         self.MockReceiver.raise_keyboard_interrupt = False
Example #8
0
 def test_evcam(self):
     evcam(Polaroid, timer=timer)
     evcam(Polaroid, timer=timer, loglevel="CRITICAL")
     self.MockReceiver.raise_keyboard_interrupt = True
     try:
         with self.assertRaises(SystemExit):
             evcam(Polaroid, timer=timer)
     finally:
         self.MockReceiver.raise_keyboard_interrupt = False
Example #9
0
 def test_evcam(self):
     evcam(Polaroid, timer=timer, app=self.app)
     evcam(Polaroid, timer=timer, loglevel='CRITICAL', app=self.app)
     self.MockReceiver.raise_keyboard_interrupt = True
     try:
         with pytest.raises(SystemExit):
             evcam(Polaroid, timer=timer, app=self.app)
     finally:
         self.MockReceiver.raise_keyboard_interrupt = False
Example #10
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()
Example #11
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()
Example #12
0
 def test_evcam_pidfile(self, create_pidlock):
     evcam(Polaroid, timer=timer, pidfile='/var/pid', app=self.app)
     create_pidlock.assert_called_with('/var/pid')
Example #13
0
 def test_evcam_pidfile(self, create_pidlock):
     evcam(Polaroid, timer=timer, pidfile="/var/pid")
     create_pidlock.assert_called_with("/var/pid")
 def test_evcam(self):
     evcam(Polaroid, timer=timer)
     evcam(Polaroid, timer=timer, loglevel="CRITICAL")
     self.MockReceiver.raise_keyboard_interrupt = True
     self.assertRaises(SystemExit, evcam, Polaroid, timer=timer)
Example #15
0
 def run_evcam(self, *args, **kwargs):
     from celery.events.snapshot import evcam
     self.set_process_status("cam")
     kwargs["app"] = self.app
     return evcam(*args, **kwargs)
Example #16
0
 def test_evcam_pidfile(self, create_pidlock):
     evcam(Polaroid, timer=timer, pidfile="/var/pid")
     create_pidlock.assert_called_with("/var/pid")
Example #17
0
 def test_evcam_pidfile(self, create_pidlock):
     evcam(Polaroid, timer=timer, pidfile='/var/pid', app=self.app)
     create_pidlock.assert_called_with('/var/pid')
 def test_evcam(self):
     evcam(Polaroid, timer=timer)
     evcam(Polaroid, timer=timer, loglevel="CRITICAL")
     self.MockReceiver.raise_keyboard_interrupt = True
     self.assertRaises(SystemExit, evcam, Polaroid, timer=timer)