Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAG not found in serialized_dag table #98

Closed
nvn01234 opened this issue Jun 11, 2021 · 11 comments
Closed

DAG not found in serialized_dag table #98

nvn01234 opened this issue Jun 11, 2021 · 11 comments
Labels
bug Something isn't working

Comments

@nvn01234
Copy link
Contributor

nvn01234 commented Jun 11, 2021

Step by step to reproduce the bug:

  • Step 1: Delete a dag in code
  • Step 2: Do not delete the DAG on the UI, wait for it disappeared on the UI
  • Step 3: Go to admin/metrics, you will get the bug as the picture below
    image

Currently I have to run a CLI command: airflow dags delete <dag_id> to completely remove all records related to a deleted dag

The solution can be: Ignore the deleted dags (don't show them in metrics)

/label ~bug

@elephantum
Copy link
Contributor

Interesting, thanks for reporting.

@elephantum elephantum added the bug Something isn't working label Jun 11, 2021
@sawaca96
Copy link
Contributor

@nvn01234
I experienced the same thing.

In my case, the error occurred if it disappeared from UI due to git-sync but remained in the DB

you solve this error just delete dag from DB. Use airflow cli airflow dags delete <dag_id> -y

@biryukovsky
Copy link

biryukovsky commented Jul 1, 2021

I had a similar problem. In my case the exception message was like "airflow.exception.SerializedDagNoFound: DAG 'None' not found in serialized_dag table". Fixed with following query in airflow database:
DELETE FROM dag_run WHERE dag_id IS NULL;

@elephantum
Copy link
Contributor

Hi, everyone!

If anyone would have time to create a PR that fixes it, I would be grateful. Fix should not be too complex.

@sawaca96
Copy link
Contributor

sawaca96 commented Jul 1, 2021

@elephantum How should I fix it?
just fix it to ignore airflow.exceptions.SerializedDagNotFound ?

@elephantum
Copy link
Contributor

I would suggest altering sqlalchemy query for this case, most probably simple join with dag table would be enough.

I.e. filter out such tasks and dags that do not have corresponding dag in DB.

@sawaca96
Copy link
Contributor

sawaca96 commented Jul 3, 2021

@elephantum #105 I create PR
Thank you for the opportunity.😁😁

@CyberHippo
Copy link

Experienced it as well.

@baryluk
Copy link

baryluk commented Aug 6, 2021

Same issue here, with airflow-exporter 1.5.1,

and airflow 1.10.15, (where for some very old dags we do not have serialized_dag entries, as we only enabled that option few weeks ago in preparation for the Airflow 2.x update), but it will be an issue when I upgrade to 2.x, because we will be preserving full history.

I have a single dag in dag table, that is no longer available. Looking at postgresql database it has is_paused false, is_subdag false, is_active false.

@elephantum
Copy link
Contributor

Fixed in v1.5.2

@baryluk
Copy link

baryluk commented Aug 17, 2021

Excellent, it works. Thanks @sawaca96 and @elephantum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants