code: def purge_old_user_tasks():
      
      limit = now() - settings.USER_TASKS_MAX_AGE
      # UserTaskArtifacts will also be removed via deletion cascading
      UserTaskStatus.objects.filter(created__lt=limit).delete()
docs: Delete any UserTaskStatus and UserTaskArtifact records older than ``settings.USER_TASKS_MAX_AGE``.
  
      Intended to be run as a scheduled task.