2020-10-13 23:25:27 +02:00
|
|
|
from functools import wraps
|
|
|
|
from logging import getLogger
|
|
|
|
|
2021-02-27 20:27:36 +01:00
|
|
|
from platypush.common import exec_wrapper
|
|
|
|
|
2020-10-13 23:25:27 +02:00
|
|
|
logger = getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def cron(cron_expression: str):
|
|
|
|
def wrapper(f):
|
|
|
|
f.cron = True
|
|
|
|
f.cron_expression = cron_expression
|
|
|
|
|
|
|
|
@wraps(f)
|
|
|
|
def wrapped(*args, **kwargs):
|
2021-02-27 20:27:36 +01:00
|
|
|
return exec_wrapper(f, *args, **kwargs)
|
2020-10-13 23:25:27 +02:00
|
|
|
|
|
|
|
return wrapped
|
|
|
|
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
|
|
|
|
# vim:sw=4:ts=4:et:
|