-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dagster-airflow] add airflow 2 support to `make_dagster_job_from_air…
…flow_dag` + xcom mock option (#10337)
- Loading branch information
1 parent
9157ebb
commit 251b666
Showing
7 changed files
with
91 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
31 changes: 31 additions & 0 deletions
31
examples/with_airflow/with_airflow/airflow_kubernetes_dag.py
This file contains 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,31 @@ | ||
# pylint: disable=pointless-statement | ||
|
||
from airflow import models | ||
from airflow.operators.dummy_operator import DummyOperator | ||
from airflow.providers.cncf.kubernetes.operators.kubernetes_pod import KubernetesPodOperator | ||
from airflow.utils.dates import days_ago | ||
|
||
default_args = {"start_date": days_ago(1)} | ||
|
||
with models.DAG( | ||
dag_id="kubernetes_dag", default_args=default_args, schedule_interval=None | ||
) as kubernetes_dag: | ||
|
||
run_this_last = DummyOperator( | ||
task_id="sink_task_1", | ||
dag=kubernetes_dag, | ||
) | ||
|
||
k = KubernetesPodOperator( | ||
name="hello-dry-run", | ||
# will need to modified to match your k8s context | ||
cluster_context="hooli-user-cluster", | ||
namespace="default", | ||
image="debian", | ||
cmds=["bash", "-cx"], | ||
arguments=["echo", "10"], | ||
labels={"foo": "bar"}, | ||
task_id="dry_run_demo", | ||
do_xcom_push=True, | ||
) | ||
k >> run_this_last |
This file contains 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
This file contains 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
This file contains 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
This file contains 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