You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/06/09 07:52:27 UTC

[GitHub] [airflow] Chris-OA-AF opened a new issue, #24341: DAG Import Error when using default_args for TaskGroup

Chris-OA-AF opened a new issue, #24341:
URL: https://github.com/apache/airflow/issues/24341

   ### Apache Airflow version
   
   2.1.4
   
   ### What happened
   
   As per the [official documentation](https://airflow.apache.org/docs/apache-airflow/stable/concepts/dags.html#taskgroups) TaskGroups support the use of default_args argument, but the use results in an import error:
   
   Broken DAG: [/home/airflow/gcs/dags/test_dag.py] Traceback (most recent call last):
     File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
     File "/home/airflow/gcs/dags/test_dag.py", line 15, in <module>
       with TaskGroup('group1', default_args={'retries': 3}):
   TypeError: __init__() got an unexpected keyword argument 'default_args'
   
   ### What you think should happen instead
   
   DAG should have been imported without errors and the use of default_args should be possible as per the [official documentation](https://airflow.apache.org/docs/apache-airflow/stable/concepts/dags.html#taskgroups)
   
   ### How to reproduce
   
   Code is taken from the [official documentation](https://airflow.apache.org/docs/apache-airflow/stable/concepts/dags.html#taskgroups)
   
   ```python
   from airflow.models.dag import DAG
   from airflow.operators.bash import BashOperator
   from airflow.operators.dummy import DummyOperator
   from airflow.utils.dates import days_ago
   from airflow.utils.task_group import TaskGroup
   import pendulum
   
   with DAG(
       dag_id='dag_dev_20220609',
       start_date=pendulum.datetime(2022, 1, 1, tz="UTC"),
       schedule_interval="@daily",
       catchup=False,
       default_args={'retries': 1},
   ):
       with TaskGroup('group1', default_args={'retries': 3}):
           task1 = BashOperator(task_id='task1', bash_command='echo Hello World! task1')
           task2 = BashOperator(task_id='task2', bash_command='echo Hello World! task2', retries=2)
           print(task1.retries) # 3
           print(task2.retries) # 2
   ```
   
   ### Operating System
   
   Google Cloud Composer
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Composer
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   Problem occurs every time
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] Chris-OA-AF commented on issue #24341: DAG Import Error when using default_args for TaskGroup

Posted by GitBox <gi...@apache.org>.
Chris-OA-AF commented on issue #24341:
URL: https://github.com/apache/airflow/issues/24341#issuecomment-1150967673

   Thanks for the clarification @uranusjr and apologies for the unnecessary effort.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] boring-cyborg[bot] commented on issue #24341: DAG Import Error when using default_args for TaskGroup

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #24341:
URL: https://github.com/apache/airflow/issues/24341#issuecomment-1150792228

   Thanks for opening your first issue here! Be sure to follow the issue template!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] uranusjr commented on issue #24341: DAG Import Error when using default_args for TaskGroup

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #24341:
URL: https://github.com/apache/airflow/issues/24341#issuecomment-1150957284

   You are reading the documentation for a wrong version. The aregument was introduced in 2.2.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] uranusjr closed issue #24341: DAG Import Error when using default_args for TaskGroup

Posted by GitBox <gi...@apache.org>.
uranusjr closed issue #24341: DAG Import Error when using default_args for TaskGroup
URL: https://github.com/apache/airflow/issues/24341


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org