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

Remove super().__init__() call in backported hooks #7833

Merged

Conversation

turbaszek
Copy link
Member


Issue link: WILL BE INSERTED BY boring-cyborg

Make sure to mark the boxes below before creating PR: [x]


In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.

@turbaszek turbaszek requested a review from potiuk March 23, 2020 12:47
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()
Copy link
Member

Choose a reason for hiding this comment

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

Do you think instead of removing we can change it to super(BashOperator, self) format which is compatible in both Py2 and Py3 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is in signature:

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

class BaseHook(LoggingMixin):
"""
Abstract base class for hooks, hooks are meant as an interface to
interact with external systems. MySqlHook, HiveHook, PigHook return
object that can handle the connection and interaction to specific
instances of these systems, and expose consistent methods to interact
with them.
"""
def __init__(self, source):
pass

Copy link
Member Author

Choose a reason for hiding this comment

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

On actual master the super().__init__() calls LoggingMixin

Copy link
Member

Choose a reason for hiding this comment

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

argghhh, in that case, removal is better I agree 👍

@codecov-io
Copy link

Codecov Report

Merging #7833 into master will decrease coverage by 0.31%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7833      +/-   ##
==========================================
- Coverage   86.95%   86.64%   -0.32%     
==========================================
  Files         926      926              
  Lines       44974    44975       +1     
==========================================
- Hits        39109    38969     -140     
- Misses       5865     6006     +141     
Impacted Files Coverage Δ
...viders/google/cloud/example_dags/example_pubsub.py 100.00% <100.00%> (ø)
airflow/providers/google/cloud/hooks/pubsub.py 94.47% <100.00%> (+0.03%) ⬆️
airflow/kubernetes/volume_mount.py 44.44% <0.00%> (-55.56%) ⬇️
airflow/kubernetes/volume.py 52.94% <0.00%> (-47.06%) ⬇️
airflow/security/kerberos.py 30.43% <0.00%> (-45.66%) ⬇️
airflow/kubernetes/pod_launcher.py 47.18% <0.00%> (-45.08%) ⬇️
...viders/cncf/kubernetes/operators/kubernetes_pod.py 69.69% <0.00%> (-25.26%) ⬇️
airflow/kubernetes/refresh_config.py 50.98% <0.00%> (-23.53%) ⬇️
airflow/jobs/scheduler_job.py 90.73% <0.00%> (-0.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4bde99f...921bc7c. Read the comment docs.

@turbaszek
Copy link
Member Author

The CI is green but the status was not updated :< @potiuk should we merge?

@mik-laj mik-laj merged commit 3cc37b1 into apache:master Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants