[WIP][AIRFLOW-594] Add dag source plugin hooks#4531
[WIP][AIRFLOW-594] Add dag source plugin hooks#4531drewsonne wants to merge 11 commits intoapache:masterfrom
Conversation
|
It feels like creating a plugin to deploy DAGs is an unnecessary extra step. Also, DAGs aren't really plugins, right? Wouldn't it be easier to just provide a separate entry-point for DAGs? #730, which never got merged, has an example of this. Btw., thanks for working on this, and also #4412, these are great improvements! |
|
This doesn't assume DAGs are plugins, and although it would be easier for this specific functionality, yes, if someone wanted to:
then we need new PRs for each of those pieces of functionality and wait for the release cycle, unless we're building airflow from src in our prod env's. If this (eventually, after I clean the PR up) is approved, the next step is a built-in plugin to load DAGs from entrypoints. |
|
Great points, I was too focused on my own particular use-case! |
|
You did make me think some of these through a bit harder, and I think I should change the PR to reflect :-) |
609eb7d to
0a3477d
Compare
3494b72 to
f6fddde
Compare
adad27b to
1c64713
Compare
9b2221d to
c17d546
Compare
b64cb4e to
5aba041
Compare
docs/conf.py
Outdated
There was a problem hiding this comment.
This look like a unreleated changes. This should be done in a separate PR.
There was a problem hiding this comment.
yeah, I was trying to figure out why the doc step was failing in the build on travis
docs/plugins.rst
Outdated
There was a problem hiding this comment.
Good point. I thought about it yesterday and I was planning to improve it.
docs/plugins.rst
Outdated
There was a problem hiding this comment.
| * For ``AirflowPluginDagSource`` plugin, ``name``, ``add_dags_to_dagbag``, and | |
| * For ::class:`~airflow.plugin.AirflowPluginDagSource` plugin, ``name``, ``add_dags_to_dagbag``, and |
This will allow automatic linking to the class documentation when such documentation will be created.
There was a problem hiding this comment.
I gotta fix the test cases and then I'll crack on with the doc problems :-D
Add property to the AirflowPlugin object which takes a list of `AirflowPluginDagSource` objects to provide a structure to aggregate DAGs from disparate sources and provide them to Airflow.
Provides Hooks in model initialisaiton to allow callbacks to DAG source plugins to inject DAGs at runtime.
29cfc09 to
6037183
Compare
Make sure you have checked all steps below.
Jira
Description
Here are some details about my PR, including screenshots of any UI changes:
This PR is a precursor to loading DAGs from pip packages. It provides a new plugin structure,
AirflowPluginDagSourcewith two methodscollect_dags_from_pluginsandput_dag_plugins_on_diskwhere a Plugin author can:implement the former and provide logic to inject the
airflow.model.DAGobjects into a providedairflow.modal.DagBagobject using their own custom logic,or implement the latter and provide logic to write the dag python files to disk in the dag folder where they will be collected by the normal DAG loading setup.
From discussion below, potential use cases could be:
Tests
Commits
Documentation
Code Quality
flake8