Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelauv committed Dec 9, 2024
1 parent baf9e1c commit 8760359
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions providers/src/airflow/providers/standard/sensors/time_delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from packaging.version import Version

from airflow.configuration import conf
from airflow.exceptions import AirflowSkipException
from airflow.providers.standard.triggers.temporal import DateTimeTrigger, TimeDeltaTrigger
from airflow.providers.standard.utils.version_references import AIRFLOW_V_3_0_PLUS
from airflow.sensors.base import BaseSensorOperator
Expand Down Expand Up @@ -89,15 +88,10 @@ def execute(self, context: Context) -> bool | NoReturn:
if timezone.utcnow() > target_dttm:
# If the target datetime is in the past, return immediately
return True
try:
if AIRFLOW_V_3_0_PLUS:
trigger = DateTimeTrigger(moment=target_dttm, end_from_trigger=self.end_from_trigger)
else:
trigger = DateTimeTrigger(moment=target_dttm)
except (TypeError, ValueError) as e:
if self.soft_fail:
raise AirflowSkipException("Skipping due to soft_fail is set to True.") from e
raise
if AIRFLOW_V_3_0_PLUS:
trigger = DateTimeTrigger(moment=target_dttm, end_from_trigger=self.end_from_trigger)
else:
trigger = DateTimeTrigger(moment=target_dttm)

# todo: remove backcompat when min airflow version greater than 2.11
timeout: int | float | timedelta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from asgiref.sync import sync_to_async
from sqlalchemy import func

from airflow.sensors.base import FailPolicy
from airflow.models import DagRun
from airflow.sensors.base import FailPolicy
from airflow.providers.standard.utils.sensor_helper import _get_count
from airflow.providers.standard.utils.version_references import AIRFLOW_V_3_0_PLUS
from airflow.triggers.base import BaseTrigger, TriggerEvent
Expand Down

0 comments on commit 8760359

Please sign in to comment.