-
Notifications
You must be signed in to change notification settings - Fork 0
Run ExecutionMode.AIRFLOW_ASYNC dag with deferrable False
#12
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
15 commits
Select commit
Hold shift + click to select a range
93b44a1
Add DBT project to run benchmark for async execution mode
pankajastro 6f139dd
Apply review feedback
pankajastro fde45dc
Ignore .user.yml and remove it from tracking
pankajastro 905796c
Run async dag with deferrable False
pankajastro 68414ac
Apply suggestion from @pankajastro
pankajastro 0cacaf5
Merge branch 'main' into run_sync_dag
pankajastro 077504c
delete macros
pankajastro 6bc675c
Add script
pankajastro aa65b15
Mock deferrable kwarg
pankajastro f75372a
Merge branch 'main' into run_sync_dag
pankajastro 60cc40b
Apply suggestion from @pankajastro
pankajastro e257caa
update image name
pankajastro f1ad9f7
Apply suggestion from @pankajastro
pankajastro 19cb7ff
Merge branch 'main' into run_sync_dag
pankajastro 0ef6a97
Scope deferrable=False to cosmos_bq_sync tasks only
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,28 @@ | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: airflow-test-cosmos-sync | ||
| spec: | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: cosmos-sync | ||
| image: benchmark:0.0.3 | ||
| imagePullPolicy: Never | ||
| command: ["airflow", "dags", "test", "cosmos_bq_sync"] | ||
| env: | ||
| - name: AIRFLOW_CONN_GCP_GS_CONN | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: gcp-credentials | ||
| key: airflow-conn | ||
| resources: | ||
| # Equivalent to Astro's A10 instance | ||
| requests: | ||
| cpu: "2" | ||
| memory: "4Gi" | ||
| limits: | ||
| cpu: "2" | ||
| memory: "4Gi" | ||
| restartPolicy: Never | ||
| backoffLimit: 0 |
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,45 @@ | ||
| from datetime import datetime | ||
| from pathlib import Path | ||
|
|
||
| from cosmos import DbtDag, ExecutionConfig, ExecutionMode, ProfileConfig, ProjectConfig | ||
| from cosmos.operators._asynchronous.bigquery import DbtRunAirflowAsyncBigqueryOperator | ||
| from cosmos.profiles import GoogleCloudServiceAccountDictProfileMapping | ||
| from include.constants import BIGQUERY_DATASET, DBT_ADAPTER_VERSION, GCP_PROJECT_ID | ||
|
|
||
| DBT_PROJECT_PATH = Path("/usr/local/airflow/dbt/altered_jaffle_shop") | ||
|
|
||
|
|
||
|
|
||
| profile_config = ProfileConfig( | ||
| profile_name="altered_jaffle_shop", | ||
| target_name="dev", | ||
| profile_mapping=GoogleCloudServiceAccountDictProfileMapping( | ||
| conn_id="gcp_gs_conn", profile_args={"dataset": BIGQUERY_DATASET, "project": GCP_PROJECT_ID} | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| cosmos_bq_sync = DbtDag( | ||
| # dbt/cosmos-specific parameters | ||
| project_config=ProjectConfig(DBT_PROJECT_PATH), | ||
| profile_config=profile_config, | ||
| execution_config=ExecutionConfig( | ||
| execution_mode=ExecutionMode.AIRFLOW_ASYNC, | ||
| async_py_requirements=[f"dbt-bigquery=={DBT_ADAPTER_VERSION}"], | ||
| ), | ||
| # normal dag parameters | ||
| schedule=None, | ||
| start_date=datetime(2026, 1, 1), | ||
| catchup=False, | ||
| dag_id="cosmos_bq_sync", | ||
| tags=["simple"], | ||
| operator_args={ | ||
| "location": "US", | ||
| "install_deps": True, | ||
| "full_refresh": True, | ||
| }, | ||
| ) | ||
|
|
||
| for task in cosmos_bq_sync.tasks: | ||
| if isinstance(task, DbtRunAirflowAsyncBigqueryOperator): | ||
| task.deferrable = False | ||
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.