-
Notifications
You must be signed in to change notification settings - Fork 235
Add jinja2 template example #450
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
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
dcf5429
Add jinja2 template example
pankajastro f688669
Fix some import
pankajastro 8e724ef
Fix some import
pankajastro 0da4e57
Fix test
pankajastro e3bf811
Fix unit tests
pankajastro 081c67b
Fix unit tests
pankajastro 35de485
cleanup
pankajastro 7a95ea6
Install Airflow 3.0.2
pankajastro 2c06ec0
Install Airflow 3.0.2
pankajastro 9c4d9fc
Force reinstall
pankajastro 567aff0
Force reinstall
pankajastro 52658ae
change pythonpath
pankajastro 64bc5ec
Remove reinstall
pankajastro 3864782
Not use dag.test
pankajastro 07ec3c2
Not use dag.test
pankajastro 64e9099
Add more linting rule
pankajastro 3cd420d
use no cache
pankajastro ac94c0e
Force to install apache-airflow>3.0.2
pankajastro d89c941
Force to install apache-airflow>3.0.2
pankajastro 2557b0b
Force to install apache-airflow>=3.0.2
pankajastro be68b9e
Force to install apache-airflow>=3.0.2
pankajastro 79ad54c
Force reinstall airflow 3
pankajastro f81b5fe
Install cncf
pankajastro 4a41484
Install cncf
pankajastro 8925000
Install cncf
pankajastro 90bb092
Fix static check
pankajastro 2b863a8
Revert CI changes
pankajastro ebdd7a7
Revert CI changes
pankajastro b2614b8
Revert CI changes
pankajastro 2824d5a
Merge branch 'main' into jinja_template_example
pankajastro 635e0cf
Revert CI changes
pankajastro cd8fa89
Merge branch 'main' into jinja_template_example
pankajastro bc63f7c
Fix tests
pankajastro ec7f67b
Update dag
pankajastro c39879d
Revert some changes
pankajastro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import os | ||
| from pathlib import Path | ||
|
|
||
| # The following import is here so Airflow parses this file | ||
| # from airflow import DAG | ||
| import dagfactory | ||
|
|
||
| DEFAULT_CONFIG_ROOT_DIR = "/usr/local/airflow/dags/" | ||
| CONFIG_ROOT_DIR = Path(os.getenv("CONFIG_ROOT_DIR", DEFAULT_CONFIG_ROOT_DIR)) | ||
|
|
||
| config_file = str(CONFIG_ROOT_DIR / "example_jinja2_template_dag.yml") | ||
| example_dag_factory = dagfactory.DagFactory(config_file) | ||
|
|
||
| # Creating task dependencies | ||
| example_dag_factory.clean_dags(globals()) | ||
| example_dag_factory.generate_dags(globals()) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| example_jinja2_template_dag: | ||
| default_args: | ||
| start_date: "2025-01-01" | ||
| schedule_interval: "@daily" | ||
| description: "A DAG that uses Airflow's built-in Jinja templates" | ||
| catchup: false | ||
| tasks: | ||
| print_run_id: | ||
| operator: "airflow.operators.bash.BashOperator" | ||
| bash_command: "echo 'run-id is {{ run_id }}'" | ||
|
|
||
| print_task: | ||
| operator: "airflow.operators.bash.BashOperator" | ||
| bash_command: "echo 'The task is {{ task }}'" | ||
| dependencies: | ||
| - print_run_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Jinja2 Template | ||
|
|
||
| This example shows how to use [Apache Airflow®](https://airflow.apache.org/) built-in Jinja templating within a YAML-based DAG definition using DAG-Factory | ||
|
|
||
| ## Example DAG | ||
|
|
||
| ```yaml | ||
| --8<-- "dev/dags/example_jinja2_template_dag.yml" | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.