You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Joy Gao (JIRA)" <ji...@apache.org> on 2017/10/11 20:31:00 UTC

[jira] [Commented] (AIRFLOW-1702) access to the count of the happened retries in a python method

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

Joy Gao commented on AIRFLOW-1702:
----------------------------------

The TaskInstance has an attribute `try_number`, you can access it via the the python operator. 

i.e.
def foo(**context):
    ti = context[ti]
    retry = ti.try_number - 1
    # do something with retry count

op = PythonOperator(
    task_id='task',
    provide_context=True,
    python_callable=foo,
    dag=dag)

Hope this helps!

> access to the count of the happened retries in a python method
> --------------------------------------------------------------
>
>                 Key: AIRFLOW-1702
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1702
>             Project: Apache Airflow
>          Issue Type: Wish
>            Reporter: Igor Cherepanov
>
> hello, 
> is it possible to access to the count of the happened retries in a python method
> thanks!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)