sunank200 commented on code in PR #43902: URL: https://github.com/apache/airflow/pull/43902#discussion_r1838312507
########## providers/src/airflow/providers/google/cloud/sensors/gcs.py: ########## @@ -179,16 +183,21 @@ def ts_function(context): Act as a default callback for the GoogleCloudStorageObjectUpdatedSensor. The default behaviour is check for the object being updated after the data interval's end, - or execution_date + interval on Airflow versions prior to 2.2 (before AIP-39 implementation). + or logical_date + interval on Airflow versions prior to 2.2 (before AIP-39 implementation). """ try: return context["data_interval_end"] except KeyError: from airflow.utils import timezone - data_interval = context["dag"].infer_automated_data_interval( - timezone.coerce_datetime(context["execution_date"]) - ) + if AIRFLOW_V_3_0_PLUS: + data_interval = context["dag"].infer_automated_data_interval( + timezone.coerce_datetime(context["logical_date"]) + ) + else: + data_interval = context["dag"].infer_automated_data_interval( + timezone.coerce_datetime(context["execution_date"]) + ) Review Comment: This is actually required by compat tests as it fails for 2 with following errors: ``` providers/tests/google/cloud/sensors/test_gcs.py:281: in test_should_support_cron result = ts_function(context) /usr/local/lib/python3.9/site-packages/airflow/providers/google/cloud/sensors/gcs.py:194: in ts_function timezone.coerce_datetime(context["logical_date"]) E KeyError: 'logical_date' ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org