-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AIRFLOW-1641] Handle executor events in the scheduler
While in Backfills we do handle the executor state, we do not in the Scheduler. In case there is an unspecified error (e.g. a timeout, airflow command failure) tasks can get stuck. Closes #2715 from bolkedebruin/AIRFLOW-1641 (cherry picked from commit 2abead7) Signed-off-by: Bolke de Bruin <bolke@xs4all.nl>
- Loading branch information
1 parent
6144c6f
commit 7354976
Showing
5 changed files
with
163 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import unittest | ||
|
||
from airflow.executors.base_executor import BaseExecutor | ||
from airflow.utils.state import State | ||
|
||
from datetime import datetime | ||
|
||
|
||
class BaseExecutorTest(unittest.TestCase): | ||
def test_get_event_buffer(self): | ||
executor = BaseExecutor() | ||
|
||
date = datetime.utcnow() | ||
|
||
key1 = ("my_dag1", "my_task1", date) | ||
key2 = ("my_dag2", "my_task1", date) | ||
key3 = ("my_dag2", "my_task2", date) | ||
state = State.SUCCESS | ||
executor.event_buffer[key1] = state | ||
executor.event_buffer[key2] = state | ||
executor.event_buffer[key3] = state | ||
|
||
self.assertEqual(len(executor.get_event_buffer(("my_dag1",))), 1) | ||
self.assertEqual(len(executor.get_event_buffer()), 2) | ||
self.assertEqual(len(executor.event_buffer), 0) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters