[ https://issues.apache.org/jira/browse/AIRFLOW-3299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16675432#comment-16675432 ]
Ash Berlin-Taylor commented on AIRFLOW-3299: -------------------------------------------- My memory is a bit hazy now, but As soon as the task gets picked up by a worker(? Or maybe by the scheduler when it is enqueued) the try_number should be incremented automatically. (The whole try_number is a bit of a hack, I would rather we created a new task_instance row for each attempt, but that is a much bigger refactor) > Logs for currently running tasks fail to load > --------------------------------------------- > > Key: AIRFLOW-3299 > URL: https://issues.apache.org/jira/browse/AIRFLOW-3299 > Project: Apache Airflow > Issue Type: Bug > Components: ui > Reporter: Brad Holmes > Priority: Major > > When a task is actively running, the logs are not appearing. I have tracked > this down to the {{next_try_number}} logic of task-instances. > In [the view at line > 836|https://github.com/apache/incubator-airflow/blame/master/airflow/www/views.py#L836], > we have > {code:java} > logs = [''] * (ti.next_try_number - 1 if ti is not None else 0) > {code} > The length of the {{logs}} array informs the frontend on the number of > {{attempts}} that exist, and thus how many AJAX calls to make to load the > logs. > Here is the current logic I have observed > ||Task State||Current length of 'logs'||Needed length of 'logs'|| > |Successfully completed in 1 attempt|1|1| > |Successfully completed in 2 attempt|2|2| > |Not yet attempted|0|0| > |Actively running task, first time|0|1| > That last case is the bug. Perhaps task-instance needs a method like > {{most_recent_try_number}} ? I don't see how to make use of {{try_number()}} > or {{next_try_number()}} to meet the need here. > ||Task State||try_number()||next_try_number()||Number of Attempts _Should_ > Display|| > |Successfully completed in 1 attempt|2|2|1| > |Successfully completed in 2 attempt|3|3|2| > |Not yet attempted|1|1|0| > |Actively running task, first time|0|1|1| > [~ashb] : You implemented this portion of task-instance 11 months ago. Any > suggestions? Or perhaps the problem is elsewhere? -- This message was sent by Atlassian JIRA (v7.6.3#76005)