You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/06/06 17:30:43 UTC

[GitHub] [airflow] dossett opened a new pull request #5381: AIRFLOW-4740 make default_args end_date permissive

dossett opened a new pull request #5381: AIRFLOW-4740 make default_args end_date permissive
URL: https://github.com/apache/airflow/pull/5381
 
 
   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [ X] My PR addresses the following [Airflow Jira](https://issues.apache.org/jira/browse/AIRFLOW-4740) 
   
   ### Description
   
   A dag will accept, in its default_args, a `start_date` as simple as `2019-06-01`.  If it detects a string, it converts to a richer type ([code reference|https://github.com/apache/airflow/blob/master/airflow/models/dag.py#L217-L221]). However, it will not accept a similar string for `end_date` instead an exception like this is thrown:
   
   ```
   Traceback (most recent call last):
    File "/airflow/tests/models/test_dag.py", line 210, in test_dag_naive_start_end_dates_strings
    DAG('DAG', default_args={'start_date': '2019-06-01', 'end_date': '2019-06-05'})
    File "/airflow/airflow/models/dag.py", line 244, in __init__
    timezone.convert_to_utc(self.default_args['end_date'])
    File "/airflow/airflow/utils/timezone.py", line 92, in convert_to_utc
    if not is_localized(value):
    File "/airflow/airflow/utils/timezone.py", line 38, in is_localized
    return value.utcoffset() is not None
   AttributeError: 'str' object has no attribute 'utcoffset'
   ```
   
   That's a very confusing user experience.  `end_date` should be as permissive as `start_date`
   
   
   ### Tests
   
   - [X] My PR adds unit tests 
   
   ### Commits
   
   - [X ] My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Code Quality
   
   - [ ] Passes `flake8`
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services