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/04/13 12:08:15 UTC

[GitHub] [airflow] eladkal commented on a diff in pull request #22974: Replace usage of `DummyOperator` with `EmptyOperator`

eladkal commented on code in PR #22974:
URL: https://github.com/apache/airflow/pull/22974#discussion_r849406923


##########
tests/dags/test_only_empty_tasks.py:
##########
@@ -41,14 +41,14 @@ def __init__(self, body, *args, **kwargs):
 
 
 with dag:
-    task_a = DummyOperator(task_id="test_task_a")
+    task_a = EmptyOperator(task_id="test_task_a")
 
-    task_b = DummyOperator(task_id="test_task_b")
+    task_b = EmptyOperator(task_id="test_task_b")
 
     task_a >> task_b
 
-    task_c = MyDummyOperator(task_id="test_task_c", body={"hello": "world"})
+    task_c = MyEmptyOperator(task_id="test_task_c", body={"hello": "world"})
 
-    task_d = DummyOperator(task_id="test_task_on_execute", on_execute_callback=lambda *args, **kwargs: 1)
+    task_d = EmptyOperator(task_id="test_task_on_execute", on_execute_callback=lambda *args, **kwargs: 1)
 
-    task_e = DummyOperator(task_id="test_task_on_success", on_success_callback=lambda *args, **kwargs: 1)
+    task_e = EmptyOperator(task_id="test_task_on_success", on_success_callback=lambda *args, **kwargs: 1)

Review Comment:
   This is going to fail on mypy test.
   ```
   Run mypy.................................................................................Failed
   - hook id: mypy
   - exit code: 1
   
   tests/dags/test_only_empty_tasks.py:54: error: Argument "on_execute_callback"
   to "EmptyOperator" has incompatible type "Callable[[Context], int]"; expected
   "Optional[Callable[[Context], None]]"  [arg-type]
       ...k_id="test_task_on_execute", on_execute_callback=lambda *args, **kwarg...
                                                           ^
   tests/dags/test_only_empty_tasks.py:56: error: Argument "on_success_callback"
   to "EmptyOperator" has incompatible type "Callable[[Context], int]"; expected
   "Optional[Callable[[Context], None]]"  [arg-type]
       ...k_id="test_task_on_success", on_success_callback=lambda *args, **kwarg...
                                                           ^
   Found 2 errors in 1 file (checked 1 source file)
   
   ERROR: The previous step completed with error. Please take a look at output above 
   ```
   
   In https://github.com/apache/airflow/pull/22832/commits/2a626c73270831ccc58d8e91f035868797dba697 I removed the init of EmptyOperator (see https://github.com/apache/airflow/pull/22832#discussion_r848155925 ). Setting it back resolves the mypy issue but I'm not sure if this is the way to go.
   
   



-- 
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