You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airflow.apache.org by Ruslan Dautkhanov <da...@gmail.com> on 2018/01/16 23:10:46 UTC

AttributeError: 'NoneType' object has no attribute 'tzinfo'

Upgraded Airflow .. getting following error [1] when processing a DAG

We have 'start_date': None set in default_args.. but this used to work im
previous airflow versions.
This is a '@once DAG.. so we don't need a start_date (no back fill).



[1]

[2018-01-16 16:05:25,283] {models.py:293} ERROR - Failed to import:
> /home/rdautkha/airflow/dags/discover/discover-ora-load-2.py
> Traceback (most recent call last):
>   File
> "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py", line
> 290, in process_file
>     m = imp.load_source(mod_name, filepath)
>   File "/home/rdautkha/airflow/dags/discover/discover-ora-load-2.py", line
> 66, in <module>
>     orientation                    = 'TB',                          #
> default graph view
>   File
> "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py", line
> 2951, in __init__
>     self.timezone = self.default_args['start_date'].tzinfo
> AttributeError: 'NoneType' object has no attribute 'tzinfo'



-- 
Ruslan Dautkhanov

Re: AttributeError: 'NoneType' object has no attribute 'tzinfo'

Posted by George Leslie-Waksman <ge...@cloverhealth.com.INVALID>.
Seems like a reasonable PR to me.

On Tue, Jan 16, 2018 at 3:20 PM Ruslan Dautkhanov <da...@gmail.com>
wrote:

> Fix:
>
> vi "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py"
> :2951
> changed
>             self.timezone = self.default_args['start_date'].tzinfo
> to
>             if self.default_args['start_date']:
>                 self.timezone = self.default_args['start_date'].tzinfo
>             else:
>                 self.timezone = settings.TIMEZONE
>
> let me know if a PR makes sense for you.. at least it fixes things for us.
>
>
>
> --
> Ruslan Dautkhanov
>
> On Tue, Jan 16, 2018 at 4:10 PM, Ruslan Dautkhanov <da...@gmail.com>
> wrote:
>
> > Upgraded Airflow .. getting following error [1] when processing a DAG
> >
> > We have 'start_date': None set in default_args.. but this used to work im
> > previous airflow versions.
> > This is a '@once DAG.. so we don't need a start_date (no back fill).
> >
> >
> >
> > [1]
> >
> > [2018-01-16 16:05:25,283] {models.py:293} ERROR - Failed to import:
> >> /home/rdautkha/airflow/dags/discover/discover-ora-load-2.py
> >> Traceback (most recent call last):
> >>   File
> "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py",
> >> line 290, in process_file
> >>     m = imp.load_source(mod_name, filepath)
> >>   File "/home/rdautkha/airflow/dags/discover/discover-ora-load-2.py",
> >> line 66, in <module>
> >>     orientation                    = 'TB',                          #
> >> default graph view
> >>   File
> "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py",
> >> line 2951, in __init__
> >>     self.timezone = self.default_args['start_date'].tzinfo
> >> AttributeError: 'NoneType' object has no attribute 'tzinfo'
> >
> >
> >
> > --
> > Ruslan Dautkhanov
> >
>

Re: AttributeError: 'NoneType' object has no attribute 'tzinfo'

Posted by Ruslan Dautkhanov <da...@gmail.com>.
Fix:

vi "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py"
:2951
changed
            self.timezone = self.default_args['start_date'].tzinfo
to
            if self.default_args['start_date']:
                self.timezone = self.default_args['start_date'].tzinfo
            else:
                self.timezone = settings.TIMEZONE

let me know if a PR makes sense for you.. at least it fixes things for us.



-- 
Ruslan Dautkhanov

On Tue, Jan 16, 2018 at 4:10 PM, Ruslan Dautkhanov <da...@gmail.com>
wrote:

> Upgraded Airflow .. getting following error [1] when processing a DAG
>
> We have 'start_date': None set in default_args.. but this used to work im
> previous airflow versions.
> This is a '@once DAG.. so we don't need a start_date (no back fill).
>
>
>
> [1]
>
> [2018-01-16 16:05:25,283] {models.py:293} ERROR - Failed to import:
>> /home/rdautkha/airflow/dags/discover/discover-ora-load-2.py
>> Traceback (most recent call last):
>>   File "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py",
>> line 290, in process_file
>>     m = imp.load_source(mod_name, filepath)
>>   File "/home/rdautkha/airflow/dags/discover/discover-ora-load-2.py",
>> line 66, in <module>
>>     orientation                    = 'TB',                          #
>> default graph view
>>   File "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py",
>> line 2951, in __init__
>>     self.timezone = self.default_args['start_date'].tzinfo
>> AttributeError: 'NoneType' object has no attribute 'tzinfo'
>
>
>
> --
> Ruslan Dautkhanov
>

Re: AttributeError: 'NoneType' object has no attribute 'tzinfo'

Posted by Ruslan Dautkhanov <da...@gmail.com>.
Created jira and a PR

https://issues.apache.org/jira/browse/AIRFLOW-2351
https://github.com/apache/incubator-airflow/pull/3254

Please help review.




-- 
Ruslan Dautkhanov

On Tue, Jan 16, 2018 at 11:50 PM, Bolke de Bruin <bd...@gmail.com> wrote:

> Good point, but you have upgraded to master. Can you provide a PR?
>
> Verstuurd vanaf mijn iPad
>
> > Op 17 jan. 2018 om 00:10 heeft Ruslan Dautkhanov <da...@gmail.com>
> het volgende geschreven:
> >
> > Upgraded Airflow .. getting following error [1] when processing a DAG
> >
> > We have 'start_date': None set in default_args.. but this used to work im
> > previous airflow versions.
> > This is a '@once DAG.. so we don't need a start_date (no back fill).
> >
> >
> >
> > [1]
> >
> > [2018-01-16 16:05:25,283] {models.py:293} ERROR - Failed to import:
> >> /home/rdautkha/airflow/dags/discover/discover-ora-load-2.py
> >> Traceback (most recent call last):
> >>  File
> >> "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py",
> line
> >> 290, in process_file
> >>    m = imp.load_source(mod_name, filepath)
> >>  File "/home/rdautkha/airflow/dags/discover/discover-ora-load-2.py",
> line
> >> 66, in <module>
> >>    orientation                    = 'TB',                          #
> >> default graph view
> >>  File
> >> "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py",
> line
> >> 2951, in __init__
> >>    self.timezone = self.default_args['start_date'].tzinfo
> >> AttributeError: 'NoneType' object has no attribute 'tzinfo'
> >
> >
> >
> > --
> > Ruslan Dautkhanov
>

Re: AttributeError: 'NoneType' object has no attribute 'tzinfo'

Posted by Bolke de Bruin <bd...@gmail.com>.
Good point, but you have upgraded to master. Can you provide a PR?

Verstuurd vanaf mijn iPad

> Op 17 jan. 2018 om 00:10 heeft Ruslan Dautkhanov <da...@gmail.com> het volgende geschreven:
> 
> Upgraded Airflow .. getting following error [1] when processing a DAG
> 
> We have 'start_date': None set in default_args.. but this used to work im
> previous airflow versions.
> This is a '@once DAG.. so we don't need a start_date (no back fill).
> 
> 
> 
> [1]
> 
> [2018-01-16 16:05:25,283] {models.py:293} ERROR - Failed to import:
>> /home/rdautkha/airflow/dags/discover/discover-ora-load-2.py
>> Traceback (most recent call last):
>>  File
>> "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py", line
>> 290, in process_file
>>    m = imp.load_source(mod_name, filepath)
>>  File "/home/rdautkha/airflow/dags/discover/discover-ora-load-2.py", line
>> 66, in <module>
>>    orientation                    = 'TB',                          #
>> default graph view
>>  File
>> "/opt/airflow/airflow-20180116/src/apache-airflow/airflow/models.py", line
>> 2951, in __init__
>>    self.timezone = self.default_args['start_date'].tzinfo
>> AttributeError: 'NoneType' object has no attribute 'tzinfo'
> 
> 
> 
> -- 
> Ruslan Dautkhanov