turbaszek commented on a change in pull request #7833: Remove 
super().__init__() call in backported hooks
URL: https://github.com/apache/airflow/pull/7833#discussion_r396470979
 
 

 ##########
 File path: backport_packages/setup_backport_packages.py
 ##########
 @@ -155,6 +155,12 @@ def pure_airflow_models_filter(node: LN, capture: 
Capture, filename: Filename) -
         """Check if select is exactly [airflow, . , models]"""
         return len([ch for ch in node.children[1].leaves()]) == 3
 
+    def remove_super_init_call(node: LN, capture: Capture, filename: Filename) 
-> None:
+        for ch in node.post_order():
+            if isinstance(ch, Leaf) and ch.value == "super":
+                if any(c.value for c in ch.parent.post_order() if 
isinstance(c, Leaf)):
+                    ch.parent.remove()
 
 Review comment:
   The problem is in signature:
   
   ```[2020-03-23 09:16:06,791] {taskinstance.py:887} INFO - Executing 
<Task(CloudFunctionDeployFunctionOperator): gcf_deploy_task> on 
2020-03-22T00:00:00+00:00
   [2020-03-23 09:16:06,795] {standard_task_runner.py:53} INFO - Started 
process 587 to run task
   [2020-03-23 09:16:07,040] {logging_mixin.py:112} INFO - Running %s on host 
%s <TaskInstance: example_gcp_function.gcf_deploy_task 
2020-03-22T00:00:00+00:00 [running]> bac65bcc36b9
   [2020-03-23 09:16:07,078] {taskinstance.py:1128} ERROR - __init__() missing 
1 required positional argument: 'source'
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.6/site-packages/airflow/models/taskinstance.py", line 
966, in _run_raw_task
       result = task_copy.execute(context=context)
     File 
"/usr/local/lib/python3.6/site-packages/airflow/providers/google/cloud/operators/functions.py",
 line 194, in execute
       hook = CloudFunctionsHook(gcp_conn_id=self.gcp_conn_id, 
api_version=self.api_version)
     File 
"/usr/local/lib/python3.6/site-packages/airflow/providers/google/cloud/hooks/functions.py",
 line 50, in __init__
       super().__init__(gcp_conn_id, delegate_to)
     File 
"/usr/local/lib/python3.6/site-packages/airflow/providers/google/cloud/hooks/base.py",
 line 158, in __init__
       super().__init__()
   TypeError: __init__() missing 1 required positional argument: 'source'
   [2020-03-23 09:16:07,085] {taskinstance.py:1185} INFO - Marking task as 
FAILED.dag_id=example_gcp_function, task_id=gcf_deploy_task, 
execution_date=20200322T000000, start_date=20200323T091606, 
end_date=20200323T091607
   ```
   
   The 1.10 signature:
   
https://github.com/apache/airflow/blob/655f0cd0e640830e12dc4bf94725b5704d31ec16/airflow/hooks/base_hook.py#L37-L46

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to