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

[AIRFLOW-6192] Stop creating Hook from SFTPSensor.__init__ #6748

Merged
merged 2 commits into from
Dec 6, 2019

Conversation

kaxil
Copy link
Member

@kaxil kaxil commented Dec 6, 2019

Make sure you have checked all steps below.

Jira

Description

When I create a task based upon the SFTPSensor and then parse the Python file, do I see two log entries coming from base_hook.py referencing the default sftp connection id? I also see the same log messages whenever the DAGs are refreshed.

airflow@0030a4ae49df:~$ python dags/sftp_sensor.py
[2019-12-06 15:45:16,440] settings.py:252 INFO - settings.configure_orm(): Using pool settings. pool_size=5, max_overflow=10, pool_recycle=1800, pid=9685
/usr/local/lib/python3.7/site-packages/psycopg2/_init_.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
[2019-12-06 15:45:17,535] base_hook.py:84 INFO - Using connection to: id: sftp_default. Host: localhost, Port: 22, Schema: None, Login: airflow, Password: None, extra:

{'key_file': '~/.ssh/id_rsa', 'no_host_key_check': True}
[2019-12-06 15:45:17,539] base_hook.py:84 INFO - Using connection to: id: sftp_default. Host: localhost, Port: 22, Schema: None, Login: airflow, Password: None, extra:

{'key_file': '~/.ssh/id_rsa', 'no_host_key_check': True}
airflow@0030a4ae49df:~$ airflow list_dags
[2019-12-06 15:47:43,529] settings.py:252 INFO - settings.configure_orm(): Using pool settings. pool_size=5, max_overflow=10, pool_recycle=1800, pid=11223
/usr/local/lib/python3.7/site-packages/psycopg2/_init_.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
[2019-12-06 15:47:44,631] _init_.py:51 INFO - Using executor LocalExecutor
[2019-12-06 15:47:44,631] dagbag.py:92 INFO - Filling up the DagBag from /usr/local/airflow/dags
[2019-12-06 15:47:48,998] base_hook.py:84 INFO - Using connection to: id: sftp_default. Host: localhost, Port: 22, Schema: None, Login: airflow, Password: None, extra:

{'key_file': '~/.ssh/id_rsa', 'no_host_key_check': True}
[2019-12-06 15:47:49,005] base_hook.py:84 INFO - Using connection to: id: sftp_default. Host: localhost, Port: 22, Schema: None, Login: airflow, Password: None, extra:

{'key_file': '~/.ssh/id_rsa', 'no_host_key_check': True}

This is on v1.10.6

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

Commits

  • My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain docstrings that explain what it does
    • If you implement backwards incompatible changes, please leave a note in the Updating.md so we can assign it to a appropriate release

@kaxil kaxil requested a review from ashb December 6, 2019 17:13
@codecov-io
Copy link

codecov-io commented Dec 6, 2019

Codecov Report

Merging #6748 into master will decrease coverage by 0.44%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6748      +/-   ##
==========================================
- Coverage   84.81%   84.36%   -0.45%     
==========================================
  Files         669      669              
  Lines       37738    37740       +2     
==========================================
- Hits        32008    31841     -167     
- Misses       5730     5899     +169
Impacted Files Coverage Δ
airflow/contrib/sensors/sftp_sensor.py 100% <100%> (ø) ⬆️
airflow/operators/mysql_operator.py 100% <0%> (ø) ⬆️
airflow/operators/mysql_to_hive.py 100% <0%> (ø) ⬆️
airflow/kubernetes/volume_mount.py 44.44% <0%> (-55.56%) ⬇️
airflow/kubernetes/volume.py 52.94% <0%> (-47.06%) ⬇️
airflow/kubernetes/pod_launcher.py 45.25% <0%> (-46.72%) ⬇️
airflow/executors/sequential_executor.py 56% <0%> (-32%) ⬇️
airflow/kubernetes/refresh_config.py 50.98% <0%> (-23.53%) ⬇️
...rflow/contrib/operators/kubernetes_pod_operator.py 78.2% <0%> (-20.52%) ⬇️
airflow/utils/sqlalchemy.py 89.83% <0%> (-6.78%) ⬇️
... and 8 more

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 a873de4...5fb85fb. Read the comment docs.

@ashb ashb merged commit 993e105 into apache:master Dec 6, 2019
kaxil added a commit that referenced this pull request Dec 14, 2019
kaxil added a commit that referenced this pull request Dec 14, 2019
kaxil added a commit that referenced this pull request Dec 17, 2019
@kaxil kaxil deleted the remve-hook-from-init branch January 5, 2020 03:58
galuszkak pushed a commit to FlyrInc/apache-airflow that referenced this pull request Mar 5, 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.

4 participants