'Get a set of task instance related to this task for a specific date
range.'

def get_task_instances(self, session, start_date=None, end_date=None):

    TI = TaskInstance
    end_date = (end_date or datetime.now())
    return session.query(TI).filter((TI.dag_id == self.dag_id), (TI.task_id == self.task_id), (TI.execution_date >= start_date), (TI.execution_date <= end_date)).order_by(TI.execution_date).all()
