ashb commented on a change in pull request #16872:
URL: https://github.com/apache/airflow/pull/16872#discussion_r666005865



##########
File path: airflow/providers/dingding/example_dags/example_dingding.py
##########
@@ -55,12 +50,11 @@ def failure_callback(context):
     ).execute(context)
 
 
-args['on_failure_callback'] = failure_callback
 # [END howto_operator_dingding_failure_callback]
 
 with DAG(
     dag_id='example_dingding_operator',
-    default_args=args,
+    default_args={'owner': 'airflow', 'retries': 3, 'on_failure_callback': 
failure_callback},

Review comment:
       ```suggestion
       default_args={'retries': 3, 'on_failure_callback': failure_callback},
   ```

##########
File path: airflow/providers/qubole/example_dags/example_qubole.py
##########
@@ -55,7 +55,7 @@
         """
     )
 
-    def compare_result_fn(**kwargs):
+    def compare_result_fn():

Review comment:
       Instead of `get_current_context()` (which is something of an escape 
hatch) we should do this:
   
   ```suggestion
       def compare_result_fn(ti):
   ```

##########
File path: airflow/providers/singularity/example_dags/example_singularity.py
##########
@@ -23,19 +23,17 @@
 from airflow.providers.singularity.operators.singularity import 
SingularityOperator
 from airflow.utils.dates import days_ago
 
-default_args = {
-    'owner': 'airflow',
-    'depends_on_past': False,
-    'email': ['[email protected]'],
-    'email_on_failure': False,
-    'email_on_retry': False,
-    'retries': 1,
-    'retry_delay': timedelta(minutes=5),
-}
-
 with DAG(
     'singularity_sample',
-    default_args=default_args,
+    default_args={
+        'owner': 'airflow',
+        'depends_on_past': False,

Review comment:
       ```suggestion
   ```
   
   That is the default

##########
File path: 
airflow/providers/tableau/example_dags/example_tableau_refresh_workbook.py
##########
@@ -27,17 +27,15 @@
 from airflow.providers.tableau.sensors.tableau_job_status import 
TableauJobStatusSensor
 from airflow.utils.dates import days_ago
 
-DEFAULT_ARGS = {
-    'owner': 'airflow',
-    'depends_on_past': False,
-    'email': ['[email protected]'],
-    'email_on_failure': False,
-    'email_on_retry': False,
-}
-
 with DAG(
     dag_id='example_tableau_refresh_workbook',
-    default_args=DEFAULT_ARGS,
+    default_args={
+        'owner': 'airflow',
+        'depends_on_past': False,
+        'email': ['[email protected]'],
+        'email_on_failure': False,
+        'email_on_retry': False,
+    },

Review comment:
       ```suggestion
   ```
   
   Defaults or not actually relevant to example

##########
File path: airflow/providers/singularity/example_dags/example_singularity.py
##########
@@ -23,19 +23,17 @@
 from airflow.providers.singularity.operators.singularity import 
SingularityOperator
 from airflow.utils.dates import days_ago
 
-default_args = {
-    'owner': 'airflow',
-    'depends_on_past': False,
-    'email': ['[email protected]'],
-    'email_on_failure': False,
-    'email_on_retry': False,
-    'retries': 1,
-    'retry_delay': timedelta(minutes=5),
-}
-
 with DAG(
     'singularity_sample',
-    default_args=default_args,
+    default_args={
+        'owner': 'airflow',
+        'depends_on_past': False,
+        'email': ['[email protected]'],
+        'email_on_failure': False,
+        'email_on_retry': False,

Review comment:
       ```suggestion
   ```
   
   Not relevant to the example, so lets remove it :)

##########
File path: airflow/providers/singularity/example_dags/example_singularity.py
##########
@@ -23,19 +23,17 @@
 from airflow.providers.singularity.operators.singularity import 
SingularityOperator
 from airflow.utils.dates import days_ago
 
-default_args = {
-    'owner': 'airflow',
-    'depends_on_past': False,
-    'email': ['[email protected]'],
-    'email_on_failure': False,
-    'email_on_retry': False,
-    'retries': 1,
-    'retry_delay': timedelta(minutes=5),
-}
-
 with DAG(
     'singularity_sample',
-    default_args=default_args,
+    default_args={
+        'owner': 'airflow',

Review comment:
       ```suggestion
   ```

##########
File path: airflow/providers/qubole/example_dags/example_qubole.py
##########
@@ -64,7 +64,7 @@ def compare_result_fn(**kwargs):
         :return: True if the files are the same, False otherwise.
         :rtype: bool
         """
-        ti = kwargs['ti']
+        ti = get_current_context()["ti"]

Review comment:
       ```suggestion
   ```

##########
File path: airflow/providers/http/example_dags/example_http.py
##########
@@ -26,17 +26,20 @@
 from airflow.providers.http.sensors.http import HttpSensor
 from airflow.utils.dates import days_ago
 
-default_args = {
-    'owner': 'airflow',
-    'depends_on_past': False,
-    'email': ['[email protected]'],
-    'email_on_failure': False,
-    'email_on_retry': False,
-    'retries': 1,
-    'retry_delay': timedelta(minutes=5),
-}
-
-dag = DAG('example_http_operator', default_args=default_args, 
tags=['example'], start_date=days_ago(2))
+dag = DAG(
+    'example_http_operator',
+    default_args={
+        'owner': 'airflow',
+        'depends_on_past': False,
+        'email': ['[email protected]'],
+        'email_on_failure': False,
+        'email_on_retry': False,

Review comment:
       ```suggestion
   ```




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to