Skip to content
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

Make dag arg optional for CosmosTaskGroup #119

Merged
merged 2 commits into from
Feb 6, 2023

Conversation

josh-fell
Copy link
Contributor

Closes: #118

Typically when authoring with TaskGroups in Airflow, users will not explicitly pass a DAG object but rather set the TaskGroup within a DAG context manager. Making the dag arg optional in the CosmosTaskGroup will allow the same authoring practice. In Airflow, if a dag arg is not passed to a TaskGroup, behind the scenes airflow.models.DagContext.get_current_dag() is called to retrieve the DAG object. Since CosmosTaskGroup pushes the dag arg to its super class, and early enough in construction, the same functional behavior is triggered.

Closes: astronomer#118

Typically when authoring with TaskGroups in Airflow, users will not explicitly pass a DAG object but rather set the TaskGroup within a DAG context manager. Making the `dag` arg optional in the CosmosTaskGroup will allow the same authoring practice. In Airflow, if a `dag` arg is not passed to a TaskGroup, behind the scenes `airflow.models.DagContext.get_current_dag()` is called to retrieve the DAG object. Since CosmosTaskGroup pushes the `dag` arg to its super class, and early enough in construction, the same functional behavior is triggered.
@josh-fell josh-fell requested a review from a team as a code owner February 4, 2023 04:57
Copy link
Collaborator

@jlaneve jlaneve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

@chrishronek chrishronek added the enhancement New feature or request label Feb 4, 2023
@chrishronek chrishronek changed the base branch from main to dev February 6, 2023 17:39
@chrishronek chrishronek merged commit 0818719 into astronomer:dev Feb 6, 2023
@josh-fell josh-fell deleted the taskgroup branch February 6, 2023 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DbtTaskGroup should not need dag=dag
3 participants