You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/05/05 05:30:35 UTC

[airflow] branch master updated: More verbose logs when running `airflow check_migrations` (#15662)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 86ad628  More verbose logs when running `airflow check_migrations` (#15662)
86ad628 is described below

commit 86ad628158eb728e56c817eea2bea4ddcaa571c2
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Wed May 5 06:30:11 2021 +0100

    More verbose logs when running `airflow check_migrations` (#15662)
    
    Currently it just shows "TimeoutError: There are still unapplied migrations after 60 seconds. " which is not that helpful.
    
    This commit adds more info to show the difference in migrations in DB and source code running `check_migrations`:
    
    Now:
    
    ```
    TimeoutError: There are still unapplied migrations after 60 seconds. Migration Head(s) in DB: {'e165e7455d70'} | Migration Head(s) in Source Code: {'a13f7613ad25'}
    ```
    
    closes https://github.com/apache/airflow/issues/15650
---
 airflow/utils/db.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/airflow/utils/db.py b/airflow/utils/db.py
index 79e9c9f..979e020 100644
--- a/airflow/utils/db.py
+++ b/airflow/utils/db.py
@@ -613,7 +613,10 @@ def check_migrations(timeout):
             if source_heads == db_heads:
                 break
             if ticker >= timeout:
-                raise TimeoutError(f"There are still unapplied migrations after {ticker} seconds.")
+                raise TimeoutError(
+                    f"There are still unapplied migrations after {ticker} seconds. "
+                    f"Migration Head(s) in DB: {db_heads} | Migration Head(s) in Source Code: {source_heads}"
+                )
             ticker += 1
             time.sleep(1)
             log.info('Waiting for migrations... %s second(s)', ticker)