Пример #1
0
 def __call__(self, f, *args, **kwargs):
     f = app.task(f)
     # Add the entry to the beat_schedule.
     app.add_periodic_task(schedule=self.secs,
                           sig=f,
                           kwargs=kwargs,
                           args=args,
                           name=f.__name__)
Пример #2
0
    def inner(f):
        """
        Alias to call .delay when calling .spool

        @spooler
        def job(foo):
           pass

        # Uwsgi type of launch
        job.spool(foo='')

        # Celery type of launch
        job.delay(foo='')

        """
        worker = app.task(f)
        # Compatible with uwsgi interface.
        worker.spool = worker.delay
        return worker