You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Jose Escobar (JIRA)" <ji...@apache.org> on 2019/05/03 22:02:00 UTC

[jira] [Commented] (AIRFLOW-4128) Timezone transferring in macro doesn't work

    [ https://issues.apache.org/jira/browse/AIRFLOW-4128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16832866#comment-16832866 ] 

Jose Escobar commented on AIRFLOW-4128:
---------------------------------------

Your Airflow DAG will need to be updated to use the recommended approach when converting the datetime object's timezone. Please refer to the following [documentation|https://github.com/apache/airflow/blob/master/docs/timezone.rst#templates] found in the project's Github repository. 

I've recreated the issue by developing an airflow DAG with the recommend steps needed to convert the datetime object to with your local timezone. Refer to the following [url|[https://github.com/jhescobar05/airflow_support/blob/master/AIRFLOW-4128/test_bash_template_dag.py]] for your convenience. 

> Timezone transferring in macro doesn't work
> -------------------------------------------
>
>                 Key: AIRFLOW-4128
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4128
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: DAG
>    Affects Versions: 1.10.0, 1.10.1
>         Environment: Cloud Composer
>            Reporter: Takako Ohshima
>            Priority: Major
>
> On Airflow 1.9, it worked like this timezone transferring like below.
> But 1.10.x seems doesn’t work this way with `Error rendering template: 'NoneType' object has no attribute 'total_seconds'` error.
>  
> {code:java}
> bash_command="echo {{ execution_date.replace(tzinfo=macros.dateutil.tz.gettz('US/Pacific')) }}"
> bigquery_to_datastore_task = BashOperator(
>  dag=dag,
>  task_id="bigquery_to_datastore",
>  bash_command=bash_command,
> )
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)