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

Setup Java Flink runner PreCommit #27721

Merged
merged 10 commits into from
Aug 4, 2023
Merged

Conversation

Abacn
Copy link
Contributor

@Abacn Abacn commented Jul 27, 2023

  • Split Flink 1.13-1.16 tests from main Java PreCommit

Please add a meaningful description for your change here

Currently, Flink tests are exercised 5 times on Java PreCommit test suite. Some tests are known to be flaky (e.g. #21333). By only run on the lowest and highest supported flink version, it would reduce the flakiness by (1-x)^3 - (1-x)^5 where x is the flaky probability of a single flink test

Other flink versions are still exercised on the new GitHub Action test suite.


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 or the workflows README to see a list of phrases to trigger workflows.

* Split Flink 1.13-1.15 tests from main Java PreCommit
@github-actions github-actions bot added the build label Jul 27, 2023
@Abacn
Copy link
Contributor Author

Abacn commented Jul 27, 2023

@github-actions
Copy link
Contributor

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

R: @damccorm for label build.

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).

build.gradle.kts Outdated
dependsOn(":runners:flink:${flinkVersions[0]}:build")
dependsOn(":runners:flink:${flinkVersions[0]}:job-server:build")
dependsOn(":runners:flink:${flinkVersions[flinkVersions.size - 1]}:build")
dependsOn(":runners:flink:${flinkVersions[flinkVersions.size - 1]}:job-server:build")
Copy link
Contributor

Choose a reason for hiding this comment

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

How often are we aware of catching a java issue with flink specific tests? I'd probably vote we just move all versions into the separate suite where it can run only on flink changes. In general, I'm a big fan of smaller more targeted suites to reduce flakiness.

If the flink tests would've caught a real issue, we'll still get that when the action does its normal scheduled run.

Copy link
Contributor Author

@Abacn Abacn Jul 28, 2023

Choose a reason for hiding this comment

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

How often are we aware of catching a java issue with flink specific tests?

I do not remember a specific example, but I imagine this could happen in general.

We may still need at least one exercised in the main test suite, for the purpose of code coverage stat.

Similar practice is done in Spark runner precommit. In main test suite it runs with Spark 3.2; there is an Spark3_Version Precommit run additonal versions:

// Additional supported Spark versions (used in compatibility tests)
(btw I should name the test suite "job_PreCommit_Java_Flink_Versions" in alignment with Spark version)

Will make the main precommit suite run only one flink version, and rename the test

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok; my vote is to split it out entirely, but I can live with just one suite

We may still need at least one exercised in the main test suite, for the purpose of code coverage stat.

I don't think this is a good reason to make decisions like this. Code coverage is just a number that can be a useful indicator of places we have gaps, if its keeping us from making optimal decisions about our infrastructure we should ignore it.

Copy link
Collaborator

@andreydevyatkin andreydevyatkin left a comment

Choose a reason for hiding this comment

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

left a couple of comments on the workflow file

with:
cache-read-only: false
- name: run Java Flink PreCommit script
run: ./gradlew :flinkPreCommit
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should use the gradle action to run the task in order to add the required params - https://github.com/apache/beam/blob/master/.github/actions/gradle-command-self-hosted-action/action.yml#L48-L49

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I copy pasted (Java_Example_Dataflow) workflow. Will do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now using gradle-command-self-hosted-action

issue_comment:
types: [created]
schedule:
- cron: '20 */6 * * *'
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the intention to run the workflow exactly at the 20th minute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

manually add some randomness to distribute the job, then not all cron job start at 0th minute

# See the License for the specific language governing permissions and
# limitations under the License.

name: Java Flink Runner PreCommit
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we put PreCommit at the beginning of the workflow name? The intention is to keep and list all PreCommit workflow files together

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good! will change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved PreCommit to the first word

name: beam_PreCommit_Java_Flink_Versions (Run Java_Flink_Versions PreCommit)
steps:
- name: Git checkout
uses: actions/checkout@v3
Copy link
Collaborator

Choose a reason for hiding this comment

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

This step should use ref as per the README file - https://github.com/apache/beam/blob/master/.github/ACTIONS.md?plain=1#L65-L68. However, it should probably be different for the issue_comment event due to the issue (the fix is on my plate)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the fix!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added ref

cancel-in-progress: true

jobs:
beam_PreCommit_Java_Flink_Versions:
Copy link
Collaborator

Choose a reason for hiding this comment

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

We also need to add the timeout-minutes: limit (see the example). The default GH limit is 360, but the default limit that is used for jenkins jobs is 120 - https://github.com/apache/beam/blob/master/.test-infra/jenkins/PrecommitJobBuilder.groovy#L39. We should use this to keep track of whether we have a performance regression or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

set to 120 min

@Abacn
Copy link
Contributor Author

Abacn commented Jul 28, 2023

Workflow run successfully on fork: https://github.com/Abacn/beam/actions/runs/5694030121/job/15434371968

PTAL

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, thanks

@Abacn
Copy link
Contributor Author

Abacn commented Jul 31, 2023

Thanks @damccorm for review. Hi @andreydevyatkin would you mind taking another look about the changes made, thanks!

@Abacn
Copy link
Contributor Author

Abacn commented Jul 31, 2023

There are fixes on PreCommits yml ongoing (dispatch, trigger, etc), will integrate the fixed in this workflow also.

if: |
github.event_name == 'push' ||
github.event_name == 'pull_request_target' ||
github.event_name == 'schedule' ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please add a condition for the workflow_dispatch event?

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 see current workflows has the same (just a workflow_dispatch). What should be the pattern here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The new changes were recently merged. The following condition should be added:

github.event_name == 'workflow_dispatch' ||

.github/workflows/beam_PreCommit_Java_Flink_Versions.yml Outdated Show resolved Hide resolved
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request_target' ||
github.event_name == 'schedule' ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

The new changes were recently merged. The following condition should be added:

github.event_name == 'workflow_dispatch' ||

Comment on lines 70 to 82
- name: Git checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Rerun on comment
if: github.event.comment.body == 'Run Java_Flink_Versions PreCommit'
uses: ./.github/actions/rerun-job-action
with:
pull_request_url: ${{ github.event.issue.pull_request.url }}
github_repository: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_job: ${{ github.job }}
github_current_run_id: ${{ github.run_id }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please update these steps in accordance with recent changes:

- uses: actions/checkout@v3
- name: Setup repository
  uses: ./.github/actions/setup-action
  with:
    comment_phrase: 'Run Java_Flink_Versions PreCommit'
    github_token: ${{ secrets.GITHUB_TOKEN }}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cool

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@andreydevyatkin andreydevyatkin left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Seeing that the run has failed due to checkstyle errors, not sure this is related to your changes

@Abacn
Copy link
Contributor Author

Abacn commented Aug 3, 2023

that's strange, same command (checkStyle) passed locally and also this workflow passed before

@Abacn
Copy link
Contributor Author

Abacn commented Aug 3, 2023

Anyways, now disabled spotless and checkStyle check. We actually should do this because these are split from the main Java PreCommit, where those checks are also disabled. There is a Spotless PreCommit dedicated to run spotless and checkStyle check

@Abacn Abacn merged commit 5541412 into apache:master Aug 4, 2023
@Abacn Abacn deleted the splitflinkprecommit branch August 4, 2023 15:01
BjornPrime pushed a commit to BjornPrime/my-beam that referenced this pull request Aug 7, 2023
* Setup Java Flink runner PreCommit

* Split Flink 1.13-1.15 tests from main Java PreCommit

* Only run one flink version on main java precommit

* address comments

* set timeout

* address comment

* address comments

* Fix copy-paste

* Disable spotless and checkstyle
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.

3 participants