kaxil commented on a change in pull request #9635:
URL: https://github.com/apache/airflow/pull/9635#discussion_r449548340
##########
File path: airflow/cli/commands/task_command.py
##########
@@ -75,6 +75,7 @@ def _run_task_by_executor(args, dag, ti):
with create_session() as session:
Review comment:
The create_session context manager commits the session before exiting
the context
```
@contextlib.contextmanager
def create_session():
"""
Contextmanager that will create and teardown a session.
"""
session = settings.Session()
try:
yield session
session.commit()
except Exception:
session.rollback()
raise
finally:
session.close()
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]