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-3367] Run celery integration test with redis broker. #4207

Merged
merged 1 commit into from
Dec 3, 2018

Conversation

jmcarp
Copy link
Contributor

@jmcarp jmcarp commented Nov 18, 2018

Not sure if this is the right approach; submitting to test on travis.

Make sure you have checked all steps below.

Jira

  • My PR addresses the following Airflow Jira issues and references them in the PR title. For example, "[AIRFLOW-XXX] My Airflow PR"

Description

  • Here are some details about my PR, including screenshots of any UI changes:

Run celery integration tests with both rabbitmq and redis brokers.

Tests

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

Patch runs existing test with multiple celery brokers.

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.
    • When adding new operators/hooks/sensors, the autoclass documentation generation needs to be added.

Code Quality

  • Passes flake8

@codecov-io
Copy link

codecov-io commented Nov 18, 2018

Codecov Report

Merging #4207 into master will decrease coverage by 62.02%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #4207       +/-   ##
===========================================
- Coverage   78.07%   16.05%   -62.03%     
===========================================
  Files         201      201               
  Lines       16455    16455               
===========================================
- Hits        12848     2642    -10206     
- Misses       3607    13813    +10206
Impacted Files Coverage Δ
airflow/www_rbac/validators.py 0% <0%> (-100%) ⬇️
airflow/utils/log/es_task_handler.py 0% <0%> (-100%) ⬇️
airflow/example_dags/subdags/subdag.py 0% <0%> (-100%) ⬇️
airflow/www/validators.py 0% <0%> (-100%) ⬇️
airflow/example_dags/example_docker_operator.py 0% <0%> (-100%) ⬇️
airflow/example_dags/example_subdag_operator.py 0% <0%> (-100%) ⬇️
airflow/api/common/experimental/get_dag_runs.py 0% <0%> (-100%) ⬇️
airflow/www/forms.py 0% <0%> (-100%) ⬇️
airflow/operators/postgres_operator.py 0% <0%> (-100%) ⬇️
airflow/api/common/experimental/get_task.py 0% <0%> (-100%) ⬇️
... and 160 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 d1d612e...6f7c5cf. Read the comment docs.

@Fokko
Copy link
Contributor

Fokko commented Nov 18, 2018

Hi @jmcarp

Thanks for picking this up. Preferably you run the tests against your own Travis instance first, instead of using the Apache Travis. The hours of Apache Travis are paid, and on your own fork is for free :-)

I don't see any changes in the tests itself. Maybe it would be nice to add a test like: Run a dag with a RedisSensor, and make sure that it will pass. So we have some actual code which communicates with Travis (and therefore also uses the RedisHook).

@Fokko
Copy link
Contributor

Fokko commented Nov 18, 2018

Please consult with #4090 before you do any duplicate work :-)

@jmcarp
Copy link
Contributor Author

jmcarp commented Nov 18, 2018

@Fokko: sorry, I didn't realize this was a paid travis account. Anyway, the idea here is to test the redis backend for celery, not the redis hook or sensor, which is why I changed the test configuration but not the test code. I'll continue with this locally or on my own travis for now.

@jmcarp jmcarp force-pushed the redis-celery-integration branch 3 times, most recently from 675be46 to bd7f9cf Compare November 19, 2018 15:07
@jmcarp jmcarp changed the title [WIP] Run celery integration test with redis broker. Run celery integration test with redis broker. Nov 19, 2018
@jmcarp
Copy link
Contributor Author

jmcarp commented Nov 19, 2018

cc @ashb

@jmcarp jmcarp changed the title Run celery integration test with redis broker. [AIRFLOW-3367] Run celery integration test with redis broker. Nov 19, 2018
@jmcarp jmcarp force-pushed the redis-celery-integration branch 3 times, most recently from a885f33 to ae3447d Compare November 26, 2018 02:03
@jmcarp
Copy link
Contributor Author

jmcarp commented Nov 26, 2018

Rebased and fixed the conflict with #4090. No rush, but this should be ready for review when you have time @Fokko @ashb. This will help avoid the kind of regression I introduced in #4203.

Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

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

Looks good overall though!

test_execute_command = test_app.task(execute_command.__wrapped__)
patch_execute_command = mock.patch(
'airflow.executors.celery_executor.execute_command',
test_execute_command)
Copy link
Member

Choose a reason for hiding this comment

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

Could all this be packaged/encapsulated in a helper function so that the "core" bit of the test (i.e. the bits you haven't changed) remains clear?

from airflow.executors.celery_executor import app
from airflow.executors.celery_executor import CeleryExecutor
from airflow.executors.celery_executor import execute_command
from airflow.executors.celery_executor import celery_configuration
from airflow.executors.celery_executor import CELERY_FETCH_ERR_MSG_HEADER
Copy link
Member

Choose a reason for hiding this comment

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

from airflow.executors.celery_executor import (
    CELERY_FETCH_ERR_MSG_HEADER,
    CeleryExecutor
    app,
    celery_configuration,
    execute_command,
)

please :)

@jmcarp
Copy link
Contributor Author

jmcarp commented Nov 26, 2018

Thanks for reviewing @ashb! I updated the tests like you suggested.

@jmcarp jmcarp force-pushed the redis-celery-integration branch 3 times, most recently from 820e6ea to 279046c Compare November 29, 2018 02:03
@jmcarp
Copy link
Contributor Author

jmcarp commented Nov 29, 2018

Conflicts fixed, ready for another look @ashb.

@jmcarp
Copy link
Contributor Author

jmcarp commented Nov 30, 2018

Ping @ashb. Hopefully this will be quick to review, since most of the diff is indenting for context managers.

@ashb ashb merged commit 5710ef2 into apache:master Dec 3, 2018
@Fokko
Copy link
Contributor

Fokko commented Dec 4, 2018

LGTM, sorry for the delayed reply. I'm currently a bit short on time :(

elizabethhalper pushed a commit to cse-airflow/incubator-airflow that referenced this pull request Dec 7, 2018
aliceabe pushed a commit to aliceabe/incubator-airflow that referenced this pull request Jan 3, 2019
wmorris75 pushed a commit to modmed/incubator-airflow that referenced this pull request Jul 29, 2019
ashb pushed a commit that referenced this pull request May 22, 2020
@ashb ashb added this to the Airflow 1.10.11 milestone May 22, 2020
kaxil pushed a commit to astronomer/airflow that referenced this pull request Jun 11, 2020
kaxil pushed a commit that referenced this pull request Jul 1, 2020
cfei18 pushed a commit to cfei18/incubator-airflow that referenced this pull request Mar 5, 2021
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