def no_duplicates(function, *args, **kwargs):
@wraps(function)<EOL>def wrapper(self, *args, **kwargs):<EOL><INDENT>key = generate_key(function, *args, **kwargs)<EOL>try:<EOL><INDENT>function(self, *args, **kwargs)<EOL><DEDENT>finally:<EOL><INDENT>logging.info('<STR_LIT>', key)<EOL>cache.delete(key)<EOL><DEDENT><DEDENT>return wrapper<EOL>
Makes sure that no duplicated tasks are enqueued.