[ 
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)

Reply via email to