Fokko commented on a change in pull request #4298: [AIRFLOW-3478] Make sure 
that the session is closed
URL: https://github.com/apache/incubator-airflow/pull/4298#discussion_r240330093
 
 

 ##########
 File path: airflow/bin/cli.py
 ##########
 @@ -423,14 +418,11 @@ def unpause(args, dag=None):
 def set_is_paused(is_paused, args, dag=None):
     dag = dag or get_dag(args)
 
-    session = settings.Session()
-    dm = session.query(DagModel).filter(
-        DagModel.dag_id == dag.dag_id).first()
-    dm.is_paused = is_paused
-    session.commit()
 
 Review comment:
   So we should not remove any `.commit()` without consideration, but after the 
`create_session`, or `@provide_session` the session is committed anyway. 
Therefore the explicit `.commit()` in the code will only act as an in-between 
commit. We should close the session if we don't use it again directly.

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

Reply via email to