You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/11/23 02:34:07 UTC

[GitHub] [airflow] mikemoto commented on pull request #19746: Add import serialized dag model

mikemoto commented on pull request #19746:
URL: https://github.com/apache/airflow/pull/19746#issuecomment-976110059


   > > `models/__init__.py` has not import SerializedDagModel serialized_dag.py, so add it. I changed airflow(in site-packages) in my local enviroment, and it works, so I want to open a pull request.
   > 
   > Why is this needed?
   
   In my case, i want to add a dag file, and start dagrun immediately. I search for a function to add dag in directory [airflow.api.common.experimental], but nothing found. So i try to write the code myself, my codes are shown below:
   ![image](https://user-images.githubusercontent.com/4498225/142962581-8302c586-0f11-49d3-aef1-cfcc687e2c34.png)
   
   As in the picture, SerializedDagModel.write_dag has been commented. Then i try to run the code, exception was raised:
   ![image](https://user-images.githubusercontent.com/4498225/142962468-97d211a8-f470-4a37-a8d9-46c88aa58f52.png)
   
   I read the code, and see the function call relationship shown below:
   ![image](https://user-images.githubusercontent.com/4498225/142962900-053875be-a0eb-400f-80f5-4c09e04522d9.png)
   ![image](https://user-images.githubusercontent.com/4498225/142962934-72f85947-616c-47ee-83ce-df56c2b87da6.png)
   ![image](https://user-images.githubusercontent.com/4498225/142962973-c3a75fbc-2cc7-42d0-ad92-88fbd9abfac2.png)
   
   When I want to trigger dagrun, SerializedDagModel of the dag should already be in database, so i need to use SerializedDagModel.write_dag in my code. And I find that nearly all Model classes are imported in models/__init__.py, so I try to import SerializedDagModel too


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org