()
return inner
Construct a celery timer decorator.
    Inside the __call__, it dynamically adds the given function to the beat schedule.

    Adopted from:
    https://docs.celeryproject.org/en/master/userguide/periodic-tasks.html#beat-entries
Construct a celery timer decorator.
    Inside the __call__, it dynamically adds the given function to the beat schedule.
Construct a celery timer decorator . Inside the __call__ it dynamically adds the given function to the beat schedule .
def c_timer():
    """
    Construct a celery timer decorator.
    Inside the __call__, it dynamically adds the given function to the beat schedule.

    Adopted from:
    https://docs.celeryproject.org/en/master/userguide/periodic-tasks.html#beat-entries
    """

    from biostar.celery import app

    class inner(object):

        def __init__(self, secs, **kwargs):
            self.secs = secs

        # Handler means that not to evaluate the app at module level when calling f()
        # on_after_finalize
        @app.on_after_configure.connect
        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__)

    return inner
def c_timer ( ) : from biostar . celery import app class inner ( object ) : def __init__ ( self , secs , * * kwargs ) : self . secs = secs # Handler means that not to evaluate the app at module level when calling f() # on_after_finalize @ app . on_after_configure . connect 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__ ) return inner