Skip to content

Conversation

@potiuk
Copy link
Member

@potiuk potiuk commented Mar 18, 2019

Make sure you have checked all steps below.

Jira

Description

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

This is 3rd stage of parent https://issues.apache.org/jira/browse/AIRFLOW-3718 task. It implements executing tests in CI environment.

Note that if you are reviewer, until the first part is merged, you should only take a look at the last commit rather than at all commits - currently there is no way to make a PR to a commit that is being reviewed yet.

Tests

  • This change introduces running all Airflow tests using Multi-staging image created in previous steps.

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

No documentation needed for that change. Design is documented in https://cwiki.apache.org/confluence/display/AIRFLOW/AIP-10+Multi-layered+and+multi-stage+official+Airflow+image

Follow up documentation will be added in Simplified Development Workflow change: #4932

Code Quality

  • Passes flake8

@potiuk potiuk changed the title Multi Stage Image - Travis CI tests [AIRFLOW-4117] Multi Stage Image - Travis CI tests Mar 18, 2019
@potiuk potiuk changed the title [AIRFLOW-4117] Multi Stage Image - Travis CI tests [AIRFLOW-4117] Multi Stage Image - Travis CI tests [Step 3/3] Mar 18, 2019
@potiuk potiuk changed the title [AIRFLOW-4117] Multi Stage Image - Travis CI tests [Step 3/3] [AIRFLOW-4117] Multi-staging Image - Travis CI tests [Step 3/3] Mar 18, 2019
@potiuk potiuk force-pushed the ms-travis-ci-tests branch 2 times, most recently from 3da8bd9 to 0e9f1b7 Compare March 19, 2019 01:03
@potiuk potiuk mentioned this pull request Mar 19, 2019
@potiuk
Copy link
Member Author

potiuk commented Mar 19, 2019

Note removed.

@potiuk potiuk force-pushed the ms-travis-ci-tests branch 2 times, most recently from dd3f349 to 07cd943 Compare March 24, 2019 20:34
@potiuk
Copy link
Member Author

potiuk commented Mar 25, 2019

@ashb -> thanks for the thorough review. I will apply all the comments shortly

@potiuk potiuk force-pushed the ms-travis-ci-tests branch 2 times, most recently from 4b76f3b to 63b4a19 Compare March 29, 2019 10:28
@potiuk potiuk closed this Mar 29, 2019
@potiuk potiuk reopened this Mar 29, 2019
@potiuk
Copy link
Member Author

potiuk commented Mar 29, 2019

@Fokko @ashb -> I pushed the latest version with pretty much all comments applied (except setup.py).

There is one change that might require longer discussion/argumentation.

I had to change the ci image to use root rather than "airflow" user - so the Dockerfile is now configurable (main airflow image uses "airflow" user and "CI" image user root user.

This was needed in order to replicate CI environment on Linux. I tested it now extensively on Linux and the main problem was that when you tried to map local source folder to the container, you could not easily map it as "airflow" user and the folders are not accesible to airflow user.

This is a known Docker problem (there is an open issue for that moby/moby#2259 ). I looked at possible workaround, but it turns out, until this issue is solved, it's easiest if airflow is run as root (then everything is root-owned inside the container).

This problem does not occur on Mac because on Mac local volumes are mounted to virtual machine using user-space synchronising filesystem via virtual machine (which makes it much slower on one hand, but it allows to carry the user mapping with the bind volume). But if someone develops on Linux that could be a huge blocker for convenient development environment.

I hope this is something that you will be able to live with :)

@potiuk potiuk force-pushed the ms-travis-ci-tests branch from 63b4a19 to 9a94899 Compare March 29, 2019 15:23
@potiuk potiuk force-pushed the ms-travis-ci-tests branch from 9a94899 to 168c02f Compare March 29, 2019 16:30
@potiuk potiuk force-pushed the ms-travis-ci-tests branch 4 times, most recently from 9aca2c1 to 8833ad7 Compare April 1, 2019 06:06
Copy link
Member Author

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

@Fokko @ashb

Please take a look and see if you have any further "big" comments to it

Further progress: This commit is quite close to have the tox-less Travis CI tests. I am very close to have all the tests pass:

  • mysql is working (it was a permission problem - I solved it in one of the previous commits where I am fixing now only group write permissions for Docker context)

  • There are only three tests + minikube that are currently failing (there are few fixes I had to do beacause of change to the root user for CI tests):

  • tests.transplant_class..C.test_doctests
  • tests.www.api.experimental.test_kerberos_endpoints.ApiKerberosTests.test_trigger_dag
  • tests.test_models.DagTest.test_following_previous_schedule_daily_dag_CEST_to_CET
  • minikube tests
  • I simplified docker-compose-backend settings (now only variables specific for backend are specified there - docker compose launches all backends now. This was necessary because some of the Mysql tests use running Postgres (Postgres Hoook etc.).

  • I have added a nice summary of only failed tests at the end of the test run - this way we can see the exact list of failed tests immediately rather than searching through entire log

You can see it here for example: https://api.travis-ci.org/v3/job/513873530/log.txt

I have one outstanding question about python setup.py test behaviour (separate comment thread).

@Fokko
Copy link
Contributor

Fokko commented Apr 2, 2019

Thanks @potiuk

  • I'm a bit busy, but why do we need MySQL in the container itself? We can use the official MySQL container using docker-compose, or am I missing something?
  • Love the summary of the failing tests

@ashb
Copy link
Member

ashb commented Apr 3, 2019

This was necessary because some of the Mysql tests use running Postgres (Postgres Hoook etc.).

I thought that we skipped the operators for foreign operators:

@unittest.skipUnless('mysql' in configuration.conf.get('core', 'sql_alchemy_conn'),
"This is a MySQL test")
def test_mysql_operator_test(self):

Maybe we don't do that universally.

@potiuk
Copy link
Member Author

potiuk commented Apr 3, 2019

@Fokko -> i understand being busy. I am quite busy myself now so I move it in a slower pace than I would like to (the remainig tests and kubernetes parts).

Answering the mysql part -> we are only installing client libraries for mysql not the server ones. Our python mysql library(https://pypi.org/project/mysqlclient/) requires mysql-client and libmysqlclient-dev native libraries to be installed. Since we are using debian-stretch as a base (this is what official python images use as a base), default mysql libraries are actually mariadb ones not the "oracle mysql" ones. They are supposed to be compatible (mariadb is fork of mysql).

I figured that Airflow's target is the original "MySQL" rather than "MariaDB" so I think using "official" libs from Oracle might be better choice for CI build - that's why we have separate step to install Oracle libs (following official instructions). It's a bit long because you need to install Oracle Keys and set-up repos, but it boils down to:

apt-get install --no-install-recommends -y mysql-client libmysqlclient-dev

Note that Ubuntu has Oracle MySQL installed by default rather than MariaDB, so I guess most of airflow users will also have the MySQL client rather than MariaDB.

@feluelle
Copy link
Member

WOW great job @potiuk !

@turbaszek
Copy link
Member

Awesome! 🚀

@potiuk
Copy link
Member Author

potiuk commented Jul 18, 2019

281 and counting ... Not that I am saying anything ;)

@feluelle
Copy link
Member

^ This one doesn't count 🙄😄

@mik-laj
Copy link
Member

mik-laj commented Jul 18, 2019

This is the first full-merged AIP. One click for a man, but a big step for Airflow :-D 🍩 🍮 🍦 🍨 🍧 🍰 🍪 🍫 🍬 🍭

potiuk added a commit that referenced this pull request Jul 20, 2019
potiuk added a commit to potiuk/airflow that referenced this pull request Jul 23, 2019
ashb pushed a commit to ashb/airflow that referenced this pull request Jul 23, 2019
wmorris75 pushed a commit to modmed-external/incubator-airflow that referenced this pull request Jul 29, 2019
dharamsk pushed a commit to postmates/airflow that referenced this pull request Aug 8, 2019
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.

8 participants