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

Add Gradle sub-projects to enable parallel running of Kafka tests #26153

Merged

Conversation

johnjcasey
Copy link
Contributor

Please add a meaningful description for your change here


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

@johnjcasey
Copy link
Contributor Author

Run Java_Kafka_IO_Direct PreCommit

@johnjcasey
Copy link
Contributor Author

Run Java_Kafka_IO_Direct PreCommit

1 similar comment
@johnjcasey
Copy link
Contributor Author

Run Java_Kafka_IO_Direct PreCommit

…projects to enable running tests in parallel
@github-actions github-actions bot added the build label Apr 11, 2023
@codecov
Copy link

codecov bot commented Apr 11, 2023

Codecov Report

Merging #26153 (b2035f2) into master (a82a49b) will decrease coverage by 0.02%.
The diff coverage is n/a.

❗ Current head b2035f2 differs from pull request most recent head 63633ca. Consider uploading reports for the commit 63633ca to get more accurate results

@@            Coverage Diff             @@
##           master   #26153      +/-   ##
==========================================
- Coverage   71.17%   71.15%   -0.02%     
==========================================
  Files         787      787              
  Lines      103293   103316      +23     
==========================================
+ Hits        73516    73518       +2     
- Misses      28288    28309      +21     
  Partials     1489     1489              
Flag Coverage Δ
python 79.84% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 9 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@johnjcasey johnjcasey marked this pull request as ready for review April 12, 2023 15:46
@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@johnjcasey
Copy link
Contributor Author

run python_runners precommit

@johnjcasey
Copy link
Contributor Author

run python_coverage precommit

@johnjcasey
Copy link
Contributor Author

run java precommit

@johnjcasey
Copy link
Contributor Author

run java_gcp_io_direct precommit

@johnjcasey
Copy link
Contributor Author

java precommit failure is a flake

* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.beam.gradle.kafka.KafkaTestUtilities
Copy link
Contributor

Choose a reason for hiding this comment

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

We can have a common.gradle in sdks/java/io/kafka and then build.gradle in kafka-{version} refers to it, like what flink runner support doing: https://github.com/apache/beam/blob/master/runners/flink/1.12/build.gradle

@github-actions
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @Abacn for label java.
R: @damccorm for label build.
R: @ahmedabu98 for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@johnjcasey johnjcasey changed the title add parallel number to gradle.properties Add Gradle sub-projects to enable parallel running of Apr 12, 2023
@johnjcasey johnjcasey changed the title Add Gradle sub-projects to enable parallel running of Add Gradle sub-projects to enable parallel running of Kafka tests Apr 12, 2023
@johnjcasey
Copy link
Contributor Author

GCP IO test failure is unrelated. We might have a quota issue on Spanner tests?

@jrmccluskey
Copy link
Contributor

That's a known issue with spanner permissions #26208

@johnjcasey
Copy link
Contributor Author

All 4 failures appear to be unrelated flakes

Comment on lines +39 to +46
'"numRecords": "1000",' +
'"keySizeBytes": "10",' +
'"valueSizeBytes": "90"' +
'}',
"--readTimeout=120",
"--kafkaTopic=beam",
"--withTestcontainers=true",
"--kafkaContainerVersion=5.5.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we have these as variables that are then concatenated in the pipelineOptions?

//Because this runs many integration jobs in parallel, each of which use a
//container, it can fail locally due to performance limitations on a desktop.
//To avoid this, use --max-workers=N, where N is less than half your CPUs.
//4 is a good start for parallelism without overloading your computer.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is concerning to me, especially because Jenkins runs several jobs at the same time. If you run 2 of these jobs (or even worse, 4) on the same Jenkins machine, does the worker fall over?

I wonder if there's a version of this change that does some parallelization by default, but not this much (e.g. it spins up at most 4 containers at once)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are running fine on the Jenkins workers right now. I've tried to limit parallelism to just one sub-project, but I can only manage to configure the entire build to have a max number of workes

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'll take another stab at this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, it looks like I can't configure parallelism differently for a subproject.

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 could add artificial dependencies between some of these tasks, to try and limit parallelism, but that would be a janky fix

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok - I can live without it at first. If we see these tests failing (at a higher than normal rate) with Jenkins infra-like issues, we should consider clawing this back though

* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.beam.gradle.kafka.KafkaTestUtilities
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than having all of these in individual files, could we do this all in a loop from the base gradle file with something like

tasks.register("sparkVersion${kv.key}Test", Test) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. That is essentially what we had before, and we don't get parallelism with that because tasks within a project can't be run in parallel

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the refactor here

Copy link
Contributor

Choose a reason for hiding this comment

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

Mostly, I wanted to avoid the same lines being repeated and you accomplished that with the shared properties file

Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

LGTM, but we should definitely monitor these for causing infra failures

@johnjcasey
Copy link
Contributor Author

all failures are unrelated flakes

@johnjcasey johnjcasey merged commit 837733e into apache:master Apr 13, 2023
johnjcasey added a commit to johnjcasey/beam that referenced this pull request Apr 13, 2023
…ache#26153)

* add parallel number to gradle.properties

* remove unused config, attempt to configure higher parallelism for kafka tests

* Create generic task to represent Integration tests. Then, create sub-projects to enable running tests in parallel

* extend test timeout to reduce flakyness

* add comment for running locally

* run spotless

* factor kafka integration tests up a level

(cherry picked from commit 837733e)
jrmccluskey pushed a commit that referenced this pull request May 4, 2023
…6153) (#26263)

* add parallel number to gradle.properties

* remove unused config, attempt to configure higher parallelism for kafka tests

* Create generic task to represent Integration tests. Then, create sub-projects to enable running tests in parallel

* extend test timeout to reduce flakyness

* add comment for running locally

* run spotless

* factor kafka integration tests up a level

(cherry picked from commit 837733e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants