Issue
webserver_1 | The above exception was the direct cause of the following exception:
webserver_1 |
webserver_1 | Traceback (most recent call last):
webserver_1 | File "/usr/local/bin/airflow", line 8, in <module>
webserver_1 | sys.exit(main())
webserver_1 | File "/usr/local/lib/python3.7/site-packages/airflow/__main__.py", line 40, in main
webserver_1 | args.func(args)
webserver_1 | File "/usr/local/lib/python3.7/site-packages/airflow/cli/cli_parser.py", line 48, in command
webserver_1 | return func(*args, **kwargs)
webserver_1 | File "/usr/local/lib/python3.7/site-packages/airflow/cli/commands/db_command.py", line 31, in initdb
webserver_1 | db.initdb()
webserver_1 | File "/usr/local/lib/python3.7/site-packages/airflow/utils/db.py", line 549, in initdb
webserver_1 | upgradedb()
webserver_1 | File "/usr/local/lib/python3.7/site-packages/airflow/utils/db.py", line 684, in upgradedb
webserver_1 | command.upgrade(config, 'heads')
webserver_1 | File "/usr/local/lib/python3.7/site-packages/alembic/command.py", line 294, in upgrade
webserver_1 | script.run_env()
webserver_1 | File "/usr/local/lib/python3.7/site-packages/alembic/script/base.py", line 490, in run_env
webserver_1 | util.load_python_file(self.dir, "env.py")
webserver_1 | File "/usr/local/lib/python3.7/site-packages/alembic/util/pyfiles.py", line 97, in load_python_file
webserver_1 | module = load_module_py(module_id, path)
webserver_1 | File "/usr/local/lib/python3.7/site-packages/alembic/util/compat.py", line 184, in load_module_py
webserver_1 | spec.loader.exec_module(module)
webserver_1 | File "<frozen importlib._bootstrap_external>", line 728, in exec_module
webserver_1 | File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
webserver_1 | File "/usr/local/lib/python3.7/site-packages/airflow/migrations/env.py", line 108, in <module>
webserver_1 | run_migrations_online()
webserver_1 | File "/usr/local/lib/python3.7/site-packages/airflow/migrations/env.py", line 102, in run_migrations_online
webserver_1 | context.run_migrations()
webserver_1 | File "<string>", line 8, in run_migrations
webserver_1 | File "/usr/local/lib/python3.7/site-packages/alembic/runtime/environment.py", line 813, in run_migrations
webserver_1 | self.get_context().run_migrations(**kw)
webserver_1 | File "/usr/local/lib/python3.7/site-packages/alembic/runtime/migration.py", line 549, in run_migrations
webserver_1 | for step in self._migrations_fn(heads, self):
webserver_1 | File "/usr/local/lib/python3.7/site-packages/alembic/command.py", line 283, in upgrade
webserver_1 | return script._upgrade_revs(revision, rev)
webserver_1 | File "/usr/local/lib/python3.7/site-packages/alembic/script/base.py", line 370, in _upgrade_revs
webserver_1 | for script in reversed(list(revs))
webserver_1 | File "/usr/local/lib/python3.7/contextlib.py", line 130, in __exit__
webserver_1 | self.gen.throw(type, value, traceback)
webserver_1 | File "/usr/local/lib/python3.7/site-packages/alembic/script/base.py", line 203, in _catch_revision_errors
webserver_1 | compat.raise_(util.CommandError(resolution), from_=re)
webserver_1 | File "/usr/local/lib/python3.7/site-packages/alembic/util/compat.py", line 296, in raise_
webserver_1 | raise exception
webserver_1 | alembic.util.exc.CommandError: Can't locate revision identified by 'a13f7613ad25'
This error is currently causing us all sorts of frustrations with our Airflow deployment. We run airflow in docker and, oddly enough, this issue is happening for myself but not my coworkers, making it quite challenging to debug. We found alembic util command error can't find identifier however it is not super clear what we can do to resolve the error.
Solution
You should wipe your database and recreate it from scratch (airflow db reset
). Apparently the database you have have been corrupted - this could have happened if you used some development version of Arirflow or run some older version airflow 1.10 on Airflow 2 or the other way round.
I presume (since you are talking about co-worker's
and your
database - those are all development databases, so you should be able to reset them from scratch.
If this is a development database which uses sqlite, what can also help is to delete the sqlite3 file (you will find it in ${AIRFLOW_HOME}
directory. This will drop the database and airflow will create one from scratch automatically when starting.
Answered By - Jarek Potiuk
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.