def _task_is_running(course_id, task_type, task_key):
 running_tasks = InstructorTask.objects.filter(course_id=course_id, task_type=task_type, task_key=task_key)
 for state in READY_STATES:
  running_tasks = running_tasks.exclude(task_state=state)
 return (len(running_tasks) > 0)

def _task_is_running ( course_id , task_type , task_key ) : running_tasks = InstructorTask . objects . filter ( course_id = course_id , task_type = task_type , task_key = task_key ) for state in READY_STATES : running_tasks = running_tasks . exclude ( task_state = state ) return ( len ( running_tasks ) > 0 )
checks if a particular task is already running .