Fokko commented on issue #4298: [AIRFLOW-3478] Make sure that the session is closed URL: https://github.com/apache/incubator-airflow/pull/4298#issuecomment-446114815 Ah, now I see what we're doing. We're keeping the objects, but the session can already be closed. The error: ``` ====================================================================== ERROR: test_mark_upstream (tests.api.common.experimental.test_mark_tasks.TestMarkTasks) ---------------------------------------------------------------------- Traceback (most recent call last): File "/app/tests/api/common/experimental/test_mark_tasks.py", line 50, in setUp run_id_template="scheduled__{}") File "/app/airflow/api/common/experimental/mark_tasks.py", line 41, in _create_dagruns dates_to_create = list(set(execution_dates) - set([dr.execution_date for dr in drs])) File "/app/airflow/api/common/experimental/mark_tasks.py", line 41, in <listcomp> dates_to_create = list(set(execution_dates) - set([dr.execution_date for dr in drs])) File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/attributes.py", line 242, in __get__ return self.impl.get(instance_state(instance), dict_) File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/attributes.py", line 596, in get value = state._load_expired(state, passive) File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/state.py", line 615, in _load_expired self.manager.deferred_scalar_loader(self, toload) File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/loading.py", line 813, in load_scalar_attributes (state_str(state))) sqlalchemy.orm.exc.DetachedInstanceError: Instance <DagRun at 0x7f3bc8db3908> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3) ``` So this line crashes: https://github.com/apache/incubator-airflow/blob/master/airflow/api/common/experimental/mark_tasks.py#L42 Because the session was already closed of the `find` method, since the decorator automatically closes it.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
