<p dir="auto">This method is used in DagFileProcessor.process_file:<br>
<a href="https://github.com/apache/airflow/blob/main/airflow/dag_processing/processor.py#L787">https://github.com/apache/airflow/blob/main/airflow/dag_processing/processor.py#L787</a></p>
<p dir="auto">it needs to be changed to static</p>
<p dir="auto">airflow 1.10.12, mysql 5.7 metastore, rbac, no serialized dags, intermittent error found twice in the logs:</p>
<p dir="auto">[2020-10-15 12:28:14,502] {scheduler_job.py:167} ERROR - Got an exception! Propagating...<br>
Traceback (most recent call last):<br>
File "/home/ec2-user/venv/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 159, in _run_file_processor<br>
pickle_dags)<br>
File "/home/ec2-user/venv/lib/python3.7/site-packages/airflow/utils/db.py", line 74, in wrapper<br>
return func(*args, **kwargs)<br>
File "/home/ec2-user/venv/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 1609, in process_file<br>
dag.sync_to_db()<br>
File "/home/ec2-user/venv/lib/python3.7/site-packages/airflow/utils/db.py", line 74, in wrapper<br>
return func(*args, **kwargs)<br>
File "/home/ec2-user/venv/lib/python3.7/site-packages/airflow/models/dag.py", line 1543, in sync_to_db<br>
session.commit()<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/orm/session.py", line 1042, in commit<br>
self.transaction.commit()<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/orm/session.py", line 504, in commit<br>
self._prepare_impl()<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/orm/session.py", line 483, in _prepare_impl<br>
self.session.flush()<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/orm/session.py", line 2523, in flush<br>
self._flush(objects)<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/orm/session.py", line 2664, in _flush<br>
transaction.rollback(<em>capture_exception=True)<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 69, in <strong>exit</strong><br>
exc_value, with_traceback=exc_tb,<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/util/compat.py", line 182, in raise</em><br>
raise exception<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/orm/session.py", line 2624, in _flush<br>
flush_context.execute()<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute<br>
rec.execute(self)<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute<br>
uow,<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 236, in save_obj<br>
update,<br>
File "/home/ec2-user/venv/lib64/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 1028, in _emit_update_statements<br>
% (table.description, len(records), rows)<br>
sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'dag' expected to update 1 row(s); 0 were matched.</p>