This method is used in DagFileProcessor.process_file - it may be easier to migrate all it's internal calls instead of the whole method.
"""Test that dagbag.sync_to_db is retried on OperationalError"""
        dagbag = DagBag("/dev/null")
        mock_dag = mock.MagicMock(spec=models.DAG)
        mock_dag.is_subdag = False
        dagbag.dags["mock_dag"] = mock_dag
        op_error = OperationalError(statement=mock.ANY, params=mock.ANY, orig=mock.ANY)
        
        side_effect = [op_error, op_error, mock.ANY]
        mock_bulk_write_to_db.side_effect = side_effect
        mock_session = mock.MagicMock()
        dagbag.sync_to_db(session=mock_session)
        
        mock_bulk_write_to_db.assert_has_calls(
            [
                mock.call(mock.ANY, processor_subdir=None, session=mock.ANY),