从Airflow1.9升级到1.10之后,我再也无法在Web图形用户界面中看到任务持续时间。当我单击“任务持续时间”时,会得到以下回溯:

Traceback (most recent call last):
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/flask_admin/base.py", line 69, in inner
    return self._run_view(f, *args, **kwargs)
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/flask_admin/base.py", line 368, in _run_view
    return fn(self, *args, **kwargs)
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/flask_login.py", line 758, in decorated_view
    return func(*args, **kwargs)
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/airflow/www/utils.py", line 270, in wrapper
    return f(*args, **kwargs)
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/airflow/utils/db.py", line 74, in wrapper
    return func(*args, **kwargs)
  File "/home/ubuntu/.local/share/virtualenvs/airflow-YvxPQJVU/lib/python3.6/site-packages/airflow/www/views.py", line 1551, in duration
    fails_totals[dict_key] += tf.duration
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'

知道是什么原因吗?
这只发生在我的老家伙身上。升级后创建的新DAG不存在此问题。

最佳答案

看起来您以前记录的行在NULL列上有一个task_fail.duration。对数据库运行手动查询可能会修复您的问题:UPDATE task_fail SET duration=0 WHERE duration IS NULL——假设您可以更改记录。
为了以防万一,也一定要先找个备份。

08-28 15:03