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

[#25582] Use a Pathing Jar instead of long command line class paths in Java Boot loader. #26087

Merged
merged 7 commits into from
Apr 11, 2023

Conversation

lostluck
Copy link
Contributor

@lostluck lostluck commented Apr 4, 2023

Jars are recursive! If the manifest of one contains a manifest with a class path attribute, the JVM will load those jars. This gets around long jar sequences that can make an argument list too long.

This PR fixes an unchanged test in the Java boot_test.go, as well as adds a unit test for the pathing jar. Further, adds the container tests to the Go Tests github action, so this error doesn't recur.

Fixes #25582.


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.

@lostluck lostluck changed the title [#25582] Use a Pathing Jar instead of long class paths in Java Boot loader. [#25582] Use a Pathing Jar instead of long command line class paths in Java Boot loader. Apr 4, 2023
@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java PostCommit

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java examples on Dataflow Java 11

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java Flink PortableValidatesRunner Streaming

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Dataflow ValidatesRunner

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java Dataflow V2 ValidatesRunner

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java 11 Examples on Dataflow Runner V2

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java Examples on Dataflow Runner V2

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java Spark PortableValidatesRunner Batch

@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2023

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

R: @kennknowles for label java.
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).

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

@@ -48,7 +48,7 @@ jobs:
- name: Delete old coverage
run: "cd sdks/go/pkg && rm -rf .coverage || :"
- name: Run coverage
run: cd sdks/go/pkg && go test -coverprofile=coverage.txt -covermode=atomic ./...
run: cd sdks && go test -coverprofile=coverage.txt -covermode=atomic ./go/pkg/... ./go/container/... ./java/container/... ./python/container/... ./typescript/container/...
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: does codecov count uncovered non-go files (e.g. https://github.com/apache/beam/blob/master/sdks/java/container/license_scripts/pull_licenses_java.py)? I'm wondering if it makes sense to run container tests separately outside of the context of codecov (I'm leaning towards thinking that they should be included so this is probably a no-op).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will ignore those files, because it's unaware of files that don't receive any coverage numbers/changes.

I think we also don't have the covbot enabled for these directories either. But I'm less concerned about that than I am about the unit tests being run at all.

Copy link
Contributor Author

@lostluck lostluck Apr 4, 2023

Choose a reason for hiding this comment

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

Enabling covbot here would be out of scope for this change I think. The go tests is different because it's otherwise hard to ensure an action will run, without having a change that ensures the action runs and that was fixing a clear gap.

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM - was meant to be nonblocking, but I realize now I didn't specify that

Comment on lines 51 to 52
zf.Write([]byte("Manifest-Version: 1.0\n"))
zf.Write([]byte("Class-Path: " + strings.Join(classpaths, " ")))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: We could use Created-By: xyz to be able to trace back from a JAR to this pathing code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java Dataflow V2 ValidatesRunner

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java Spark PortableValidatesRunner Batch

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java Examples on Dataflow Runner V2

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java Flink PortableValidatesRunner Streaming

@lostluck
Copy link
Contributor Author

lostluck commented Apr 4, 2023

Run Java PostCommit

@lostluck
Copy link
Contributor Author

lostluck commented Apr 7, 2023

Run Java Examples on Dataflow Runner V2

@lostluck
Copy link
Contributor Author

lostluck commented Apr 7, 2023

Run Java Flink PortableValidatesRunner Streaming

@lostluck
Copy link
Contributor Author

lostluck commented Apr 7, 2023

Run Java Dataflow V2 ValidatesRunner

@lostluck
Copy link
Contributor Author

lostluck commented Apr 7, 2023

Run Java Spark PortableValidatesRunner Batch

@lostluck
Copy link
Contributor Author

lostluck commented Apr 7, 2023

I had misunderstood something in my earlier research: The classpath appends are URIs, not file paths. URIs are in a format like :. In this case since it should be all jar files, the class paths should be prefixed with file:.

@lostluck
Copy link
Contributor Author

lostluck commented Apr 7, 2023

Run Spotless PreCommit

@lostluck
Copy link
Contributor Author

lostluck commented Apr 11, 2023

Apparently line lengths can't exceed 72 bytes. The more you know! Not hard to fix though (and validate in testing).

And I was missing some line breaks.

@lostluck
Copy link
Contributor Author

Run Java Examples on Dataflow Runner V2

@lostluck
Copy link
Contributor Author

Run Java Flink PortableValidatesRunner Streaming

@lostluck
Copy link
Contributor Author

Run Java Spark PortableValidatesRunner Batch

@lostluck
Copy link
Contributor Author

Run Java Dataflow V2 ValidatesRunner

@lostluck
Copy link
Contributor Author

Run Java PostCommit

@lostluck lostluck merged commit e0e1398 into apache:master Apr 11, 2023
lostluck added a commit to lostluck/beam that referenced this pull request Apr 12, 2023
jakubrauch pushed a commit to jakubrauch/beam that referenced this pull request Apr 27, 2023
rezarokni pushed a commit to rezarokni/beam that referenced this pull request May 22, 2023
@lostluck lostluck mentioned this pull request May 25, 2023
3 tasks
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.

[Feature Request]: Supply classpaths to java using a pathing jar, to avoid too long command lines.
3 participants