I'm trying to add a function with a decorator for scheduling its execution but I get the following error:
ValueError: This Job cannot be serialized since the reference to its callable (<function inner at 0x7f1c900527d0>) could not be determined. Consider giving a textual reference (module:function name) instead.
My function is
@my_decorator
def my_function(id=None):
print id
and I add it as follows:
my_scheduler.add_job(function, 'interval',minutes=1)
Is it possible to add a function with decorators? Any ideas?
As a workaround I can define an inner definition and call my decorator as well but I consider it as bad solution and I would prefer using it directly
Workaround:
def outer(id=None):
@my_decorator
def my_function(id=None):
print id
my_function(id)
my_scheduler.add_job(outer, 'interval',minutes=1)