uranusjr commented on a change in pull request #22501:
URL: https://github.com/apache/airflow/pull/22501#discussion_r834283787
##########
File path: airflow/providers/google/cloud/operators/gcs.py
##########
@@ -740,19 +740,19 @@ def execute(self, context: "Context") -> List[str]:
try:
timespan_start = context["data_interval_start"]
timespan_end = context["data_interval_end"]
- except KeyError: # Data interval context variables are only available
in Airflow 2.2+
- timespan_start =
timezone.coerce_datetime(context["execution_date"])
- timespan_end =
timezone.coerce_datetime(context["dag"].following_schedule(timespan_start))
+ except KeyError:
+ timespan_start = context["execution_date"]
Review comment:
Simply something like
```python
following_execution_date =
context["dag"].following_schedule(context["execution_date"])
if following_execution_date is None:
timespan_end: Optional[pendulum.DateTime] = None
else:
timespan_end = pendulum.instance(following_execution_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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]