code: def synchronise(func):
      
      def inner(request, *args):
          lock_id = '%s-%s-built-%s' % (
              datetime.date.today(), func.__name__,
              ",".join([str(a) for a in args]))
  
          if cache.add(lock_id, 'true', LOCK_EXPIRE):
              result = func(request, *args)
              cache.set(lock_id, result.task_id)
          else:
              task_id = cache.get(lock_id)
              if not task_id:
                  return None
  
              cache.set(lock_id, "")
              result = Task.AsyncResult(task_id)
              if result.ready():
                  result.forget()
                  return None
          return result
      return inner
docs: If task already queued, running, or finished, don't restart.