Skip to content

Conversation

@markflyhigh
Copy link
Contributor

@markflyhigh markflyhigh commented Jan 30, 2019

This PR use Gradle to parallel Python 2 and 3 tox as well as integration tests (on DataflowRunner) in Python PreCommit by:

  • Group tests to Gradle tasks under multiple sub-projects:
    • beam-sdks-python:preCommitPy2
    • beam-sdks-python-test-suites-tox-py3:preCommitPy3
    • beam-sdks-python-test-suites-dataflow:preCommitIT
  • Build sdk artifact based on copy of sdk sources to avoid a concurrent issue in setuptools when using same setup.py (details: Set sdk_location for Python 3 integration tests #7793 (comment))
  • Start Cython tests after other tox tests since the side effects may affect the test behavior and result.

Reduced ~30mins for the PreCommit build:

image


Follow this checklist to help us incorporate your contribution quickly and easily:

  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

It will help us expedite review of your Pull Request if you tag someone (e.g. @username) to look at it.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- --- --- --- ---
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Python Build Status --- Build Status
Build Status
Build Status --- --- ---

@markflyhigh
Copy link
Contributor Author

Run Python PreCommit

4 similar comments
@markflyhigh
Copy link
Contributor Author

Run Python PreCommit

@markflyhigh
Copy link
Contributor Author

Run Python PreCommit

@markflyhigh
Copy link
Contributor Author

Run Python PreCommit

@markflyhigh
Copy link
Contributor Author

Run Python PreCommit

@markflyhigh
Copy link
Contributor Author

One of tox test keep failing due to error: [Errno 2] No such file or directory: 'apache-beam-2.11.0.dev0/apache_beam/runners/common_test.py'. This happens during tox packaging the distribution though the time it happens may slightly different in each run.

The build execute multiple tox commands in parallel so it's possibly a race condition. However, I set toxworkdir in tox.ini based on name of the task to avoid shared directory among builds, but it's likely I missed something else.

Triggered this test few tests and consistently failed regardless of beam nodes. Out of idea how to move forward.

@markflyhigh markflyhigh force-pushed the py3-tox-2 branch 5 times, most recently from a2d80fd to 3c6979e Compare March 7, 2019 23:21
project.exec {
executable 'sh'
args '-c', ". ${project.ext.envdir}/bin/activate && cd ${pythonRootDir} && python setup.py sdist --keep-temp --formats zip,gztar --dist-dir ${project.buildDir}"
args '-c', ". ${project.ext.envdir}/bin/activate && cd ${copiedSrcDir}/sdks/python && python setup.py sdist --formats zip,gztar --dist-dir ${project.buildDir}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we start to use copy of sdk sources to build artifact, there is no need to keep temp directory around after build. So remove --keep-temp flag here.

Copy link
Contributor

Choose a reason for hiding this comment

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

For my education, why did we need it before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this flag to fix the parallel failure in integration tests since the temp directory is shared between different build processes and by default it's deleted after a build finish. However, it never works for tox tests.

@markflyhigh
Copy link
Contributor Author

project.exec {
executable 'sh'
args '-c', ". ${project.ext.envdir}/bin/activate && cd ${pythonRootDir} && python setup.py sdist --keep-temp --formats zip,gztar --dist-dir ${project.buildDir}"
args '-c', ". ${project.ext.envdir}/bin/activate && cd ${copiedSrcDir}/sdks/python && python setup.py sdist --formats zip,gztar --dist-dir ${project.buildDir}"
Copy link
Contributor

Choose a reason for hiding this comment

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

For my education, why did we need it before?

@markflyhigh
Copy link
Contributor Author

PTAL @tvalentyn

@markflyhigh
Copy link
Contributor Author

Run Python PreCommit

@tvalentyn
Copy link
Contributor

Is this ready for review, @markflyhigh ?

@markflyhigh
Copy link
Contributor Author

Yes, please take a look. @tvalentyn

Copy link
Contributor

@tvalentyn tvalentyn left a comment

Choose a reason for hiding this comment

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

Thank you! This is great!

@tvalentyn
Copy link
Contributor

R: @aaltay

@charlesccychen
Copy link
Contributor

Thank you!

@markflyhigh
Copy link
Contributor Author

BTW, the reason why I choose copy SDK sources to isolate build is explained in #7793 (comment).

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