Jolcik opened a new pull request #20507:
URL: https://github.com/apache/airflow/pull/20507


   Recently function `date_range` in the DAG class has been changed in a way 
that made this function useless when using the `num` parameter instead of 
`end_date`.
   
   Currently, when using this function with `num` parameter, the following code 
is executed:
   
https://github.com/apache/airflow/blob/f62e690efeb80863855282d33d3e047d01af2db0/airflow/models/dag.py#L564-L573
   
   Util function `utils_date_range` (which is actually named `date_range`, but 
is renamed during import) takes these arguments:
   
https://github.com/apache/airflow/blob/f62e690efeb80863855282d33d3e047d01af2db0/airflow/utils/dates.py#L38-L43
   
   `delta` argument is theoretically optional, but the first two lines make the 
function useless without this argument.
   
https://github.com/apache/airflow/blob/f62e690efeb80863855282d33d3e047d01af2db0/airflow/utils/dates.py#L82-L83
   
   Therefore, the current implementation of `date_range` in DAG class always 
returns an empty list when using `num` argument. This fix provides `delta` of  
`self.normalized_schedule_interval` to make it properly work, which is a way 
that this function worked before changes (so more or less I'm only reverting a 
change made in [this 
commit](https://github.com/apache/airflow/commit/5034414208f85a8be61fe51d6a3091936fe402ba)).
 I also added a unit test that makes sure this doesn't happen again in the 
future.
   
   I know this function is deprecated, but it's still a small bug that IMO 
should be fixed.
   


-- 
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]


Reply via email to