Skip to content

Commit 431c40b

Browse files
authored
Remove AirflowException from Edge Example Dag (#64975)
1 parent 220ba20 commit 431c40b

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

providers/edge3/src/airflow/providers/edge3/example_dags/win_test.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@
2828
import os
2929
from collections.abc import Callable, Container, Sequence
3030
from datetime import datetime
31-
from subprocess import STDOUT, Popen
31+
from subprocess import STDOUT, Popen, SubprocessError
3232
from time import sleep
3333
from typing import TYPE_CHECKING, Any
3434

3535
from airflow.models import BaseOperator
3636
from airflow.models.dag import DAG
3737
from airflow.models.variable import Variable
3838
from airflow.providers.common.compat.sdk import (
39-
AirflowException,
4039
AirflowNotFoundException,
4140
AirflowSkipException,
4241
)
@@ -125,7 +124,7 @@ class CmdOperator(BaseOperator):
125124
* - `skip_on_exit_code` (default: 99)
126125
- raise :class:`airflow.exceptions.AirflowSkipException`
127126
* - otherwise
128-
- raise :class:`airflow.exceptions.AirflowException`
127+
- raise :class:`subprocess.SubprocessError`
129128
130129
.. warning::
131130
@@ -210,9 +209,9 @@ def get_env(self, context):
210209
def execute(self, context: Context):
211210
if self.cwd is not None:
212211
if not os.path.exists(self.cwd):
213-
raise AirflowException(f"Can not find the cwd: {self.cwd}")
212+
raise SubprocessError(f"Can not find the cwd: {self.cwd}")
214213
if not os.path.isdir(self.cwd):
215-
raise AirflowException(f"The cwd {self.cwd} must be a directory")
214+
raise SubprocessError(f"The cwd {self.cwd} must be a directory")
216215
env = self.get_env(context)
217216

218217
# Because the command value is evaluated at runtime using the @task.command decorator, the
@@ -237,7 +236,7 @@ def execute(self, context: Context):
237236
if exit_code in self.skip_on_exit_code:
238237
raise AirflowSkipException(f"Command returned exit code {exit_code}. Skipping.")
239238
if exit_code != 0:
240-
raise AirflowException(f"Command failed. The command returned a non-zero exit code {exit_code}.")
239+
raise SubprocessError(f"Command failed. The command returned a non-zero exit code {exit_code}.")
241240

242241
return self.output_processor(outs)
243242

scripts/ci/prek/known_airflow_exceptions.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ providers/discord/src/airflow/providers/discord/operators/discord_webhook.py::1
197197
providers/docker/src/airflow/providers/docker/decorators/docker.py::1
198198
providers/docker/src/airflow/providers/docker/hooks/docker.py::3
199199
providers/docker/src/airflow/providers/docker/operators/docker_swarm.py::2
200-
providers/edge3/src/airflow/providers/edge3/example_dags/win_test.py::3
201200
providers/fab/src/airflow/providers/fab/auth_manager/fab_auth_manager.py::3
202201
providers/fab/src/airflow/providers/fab/auth_manager/models/db.py::1
203202
providers/fab/src/airflow/providers/fab/www/extensions/init_security.py::1

0 commit comments

Comments
 (0)