气流"此连接已关闭"在运行但不在测试中

时间:2016-10-14 14:47:37

标签: python oracle sqlalchemy airflow

我正在使用airflow 1.7.1.3和python 2.7

当我使用

单独运行每个任务时,我创建了一个完美的DAG
  

气流测试[myDAG] [myTask] 2016-10-14

然而,

  

airflow trigger_dag [myDAG]

  

气流运行[myDAG] [myTask] 2016-10-14

都提出了一个"此连接已关闭" SQLalchemy错误。

[...]
    with self.engine.connect() as connection:
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2016, in connect
    return self._connection_cls(self, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 72, in __init__
    if connection is not None else engine.raw_connection()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2102, in raw_connection
    self.pool.unique_connection, _connection)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2072, in _wrap_pool_connect
    return fn()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 318, in unique_connection
    return _ConnectionFairy._checkout(self)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 746, in _checkout
    raise exc.InvalidRequestError("This connection is closed")
InvalidRequestError: This connection is closed
[2016-10-14 15:49:30,704] {models.py:1306} INFO - Marking task as FAILED.
[2016-10-14 15:49:30,712] {models.py:1327} ERROR - This connection is closed

这是通过SQLalchemy与Oracle 12数据库的连接,当我在脚本中使用session.commit()时会引发此错误。

有人有什么能解释这种差异和错误的线索吗?

0 个答案:

没有答案