Fix occasional external task sensor tests (#18853)
Fix occasional external task sensor tests (#18853)

Occassionally the sensor tests fail with assertion where
state seems to be None. This might be caused by

```
      def assert_ti_state_equal(task_instance, state):
          """
          Assert state of task_instances equals the given state.
          """
          task_instance.refresh_from_db()
  >       assert task_instance.state == state
  E       AssertionError: assert None == <TaskInstanceState.SUCCESS: 'success'>
  E        +  where None = <TaskI$anstance: dag_1.task_b_1 manual__2015-01-01T00:00:00+00:00 [None]>.state
```

Turned out it was because the task instance fields from
dagrun.taskinstance relationship could be returned in different
order so some of the dependencies were not met for some of the
tasks when later task was returned before earlier one.

Deterministic sorting according to task_id solved the problem.
nathanielvarona/airflow,Acehaidrey/incubator-airflow,bolkedebruin/airflow,cfei18/incubator-airflow,cfei18/incubator-airflow,Acehaidrey/incubator-airflow,lyft/incubator-airflow,Acehaidrey/incubator-airflow,nathanielvarona/airflow,apache/incubator-airflow,bolkedebruin/airflow,mistercrunch/airflow,nathanielvarona/airflow,mistercrunch/airflow,nathanielvarona/airflow,Acehaidrey/incubator-airflow,danielvdende/incubator-airflow,cfei18/incubator-airflow,danielvdende/incubator-airflow,apache/airflow,Acehaidrey/incubator-airflow,apache/airflow,bolkedebruin/airflow,nathanielvarona/airflow,Acehaidrey/incubator-airflow,apache/incubator-airflow,danielvdende/incubator-airflow,mistercrunch/airflow,bolkedebruin/airflow,danielvdende/incubator-airflow,cfei18/incubator-airflow,apache/airflow,cfei18/incubator-airflow,lyft/incubator-airflow,nathanielvarona/airflow,apache/incubator-airflow,apache/airflow,lyft/incubator-airflow,mistercrunch/airflow,apache/airflow,cfei18/incubator-airflow,danielvdende/incubator-airflow,danielvdende/incubator-airflow,apache/incubator-airflow,bolkedebruin/airflow,lyft/incubator-airflow,apache/airflow