-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Testing] Improve LocalRunner to support .nar files that aren't on the classpath #9673
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
Conversation
|
/pulsarbot run-failure-checks |
sijie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this pull request is trying to solve two things together.
Can you handle "cleanup and shutdown isn't handled in tests" first?
I am not sure how the refactor will handle PIP-62 yet. Can we defer that until it is actually happening? Let's avoid over-engineering now.
Hi @sijie . Thanks for the review.
There's no need to couple these changes with PIP-62. This PR fixes clear problems in LocalRunner. What makes you think that this is over-engineering? |
|
@jerrypeng would you mind reviewing this PR? thank you |
f0650cb to
8f1b797
Compare
|
/pulsarbot run-failure-checks |
8f1b797 to
9719aae
Compare
|
@sijie @merlimat @david-streamlio @jerrypeng @jiazhai @codelipenghui One benefit is that it simplifies the building of Pulsar since it reduces the dependencies of pulsar-broker module since it gets rid of the usage of maven-antrun-plugin plugin for copying the .nar files and pulsar-functions-api-examples.jar file to src/test/resources. This is needed so that it's possible to reuse binary artifacts in the Pulsar CI pipeline. For example, in the unit test jobs, it should be possible to reuse the binary artifacts that are built in a previous step instead of building everything with "mvn clean install" in each step. When it's possible to reuse binary artifacts, we can save about 15 minutes for each unit test and integration test build job in the GitHub Action based CI pipeline. In addition to these benefits, this PR fixes real bugs and problems in LocalRunner. Those are described in the description of this PR. Since the improvements of Pulsar CI are blocked by this PR, I'm asking for more reviews and addressable feedback. Thank you |
9719aae to
86bf8d3
Compare
86bf8d3 to
1e2872f
Compare
|
/pulsarbot run-failure-check |
1 similar comment
|
/pulsarbot run-failure-check |
|
/pulsar-bot run-failure-checks |
1e2872f to
0384e2e
Compare
rdhabalia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.. loading nar from external dir will be helpful for the tests.
|
/pulsarbot run-failure-checks |
1 similar comment
|
/pulsarbot run-failure-checks |
eolivelli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
great to see such CI enhancements
…sspath - also support the previous choice of providing the implementation classes on the Thread context classloader classpath - Pass nar file locations as system properties to tests: - Pass pulsar-io cassandra and twitter nar file locations as system properties to tests - Pass pulsar-io-data-generator.nar and pulsar-functions-api-examples.jar file locations as system properties to tests - Improve LocalRunner cleanup/shutdown which wasn't handled before. - Fix invalid test in PackagesApiTest - Make PulsarFunction tests and Sink/Source tests work with .nar files which aren't on the classpath. - Extract FileServer in tests to simplify the test code
0384e2e to
ec1bc45
Compare
|
/pulsarbot run-failure-checks |
1 similar comment
|
/pulsarbot run-failure-checks |
|
@merlimat This PR has been approved by @rdhabalia . Would you also mind checking this? |
|
/pulsarbot run-failure-checks |
4 similar comments
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
|
/pulsarbot run-failure-checks |
…r and make SchemaInfo an interface (#10878) ### Motivation The java-instance.jar generated by the pulsar-functions-runtime-all module should only contain interfaces that Pulsar Function's framework uses to interact with user code. The module should on have the following dependencies 1. pulsar-io-core 2. pulsar-functions-api 3. pulsar-client-api 4. slf4j-api 5. log4j-slf4j-impl 6. log4j-api 7. log4j-core *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications Change dep pulsar-client-original to pulsar-client-api Slight changes in the top level pom for what is included in all sub-modules so that additional deps don't land into java-instance.jar There is also a fix for an issue introduced by #9673. The thread context class loader was set incorrectly in ThreadRuntime. ### Future improvements 1. We should also add a test in the future to make sure external libraries don't get add accidentally this module and java-instance.jar 2. Rename the module "pulsar-functions-runtime-all" to something that describes its function better. The current name can be confusing
…r and make SchemaInfo an interface (#10878) ### Motivation The java-instance.jar generated by the pulsar-functions-runtime-all module should only contain interfaces that Pulsar Function's framework uses to interact with user code. The module should on have the following dependencies 1. pulsar-io-core 2. pulsar-functions-api 3. pulsar-client-api 4. slf4j-api 5. log4j-slf4j-impl 6. log4j-api 7. log4j-core *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications Change dep pulsar-client-original to pulsar-client-api Slight changes in the top level pom for what is included in all sub-modules so that additional deps don't land into java-instance.jar There is also a fix for an issue introduced by #9673. The thread context class loader was set incorrectly in ThreadRuntime. ### Future improvements 1. We should also add a test in the future to make sure external libraries don't get add accidentally this module and java-instance.jar 2. Rename the module "pulsar-functions-runtime-all" to something that describes its function better. The current name can be confusing (cherry picked from commit d81b5f8)
…r and make SchemaInfo an interface (apache#10878) ### Motivation The java-instance.jar generated by the pulsar-functions-runtime-all module should only contain interfaces that Pulsar Function's framework uses to interact with user code. The module should on have the following dependencies 1. pulsar-io-core 2. pulsar-functions-api 3. pulsar-client-api 4. slf4j-api 5. log4j-slf4j-impl 6. log4j-api 7. log4j-core *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications Change dep pulsar-client-original to pulsar-client-api Slight changes in the top level pom for what is included in all sub-modules so that additional deps don't land into java-instance.jar There is also a fix for an issue introduced by apache#9673. The thread context class loader was set incorrectly in ThreadRuntime. ### Future improvements 1. We should also add a test in the future to make sure external libraries don't get add accidentally this module and java-instance.jar 2. Rename the module "pulsar-functions-runtime-all" to something that describes its function better. The current name can be confusing (cherry picked from commit d81b5f8) (cherry picked from commit 89ac98e)
…r and make SchemaInfo an interface (apache#10878) ### Motivation The java-instance.jar generated by the pulsar-functions-runtime-all module should only contain interfaces that Pulsar Function's framework uses to interact with user code. The module should on have the following dependencies 1. pulsar-io-core 2. pulsar-functions-api 3. pulsar-client-api 4. slf4j-api 5. log4j-slf4j-impl 6. log4j-api 7. log4j-core *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications Change dep pulsar-client-original to pulsar-client-api Slight changes in the top level pom for what is included in all sub-modules so that additional deps don't land into java-instance.jar There is also a fix for an issue introduced by apache#9673. The thread context class loader was set incorrectly in ThreadRuntime. ### Future improvements 1. We should also add a test in the future to make sure external libraries don't get add accidentally this module and java-instance.jar 2. Rename the module "pulsar-functions-runtime-all" to something that describes its function better. The current name can be confusing
…sspath (apache#9673) - also support the previous choice of providing the implementation classes on the Thread context classloader classpath - Pass nar file locations as system properties to tests: - Pass pulsar-io cassandra and twitter nar file locations as system properties to tests - Pass pulsar-io-data-generator.nar and pulsar-functions-api-examples.jar file locations as system properties to tests - Improve LocalRunner cleanup/shutdown which wasn't handled before. - Fix invalid test in PackagesApiTest - Make PulsarFunction tests and Sink/Source tests work with .nar files which aren't on the classpath. - Extract FileServer in tests to simplify the test code Co-authored-by: Matteo Merli <mmerli@apache.org>
…r and make SchemaInfo an interface (apache#10878) ### Motivation The java-instance.jar generated by the pulsar-functions-runtime-all module should only contain interfaces that Pulsar Function's framework uses to interact with user code. The module should on have the following dependencies 1. pulsar-io-core 2. pulsar-functions-api 3. pulsar-client-api 4. slf4j-api 5. log4j-slf4j-impl 6. log4j-api 7. log4j-core *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications Change dep pulsar-client-original to pulsar-client-api Slight changes in the top level pom for what is included in all sub-modules so that additional deps don't land into java-instance.jar There is also a fix for an issue introduced by apache#9673. The thread context class loader was set incorrectly in ThreadRuntime. ### Future improvements 1. We should also add a test in the future to make sure external libraries don't get add accidentally this module and java-instance.jar 2. Rename the module "pulsar-functions-runtime-all" to something that describes its function better. The current name can be confusing
…r and make SchemaInfo an interface (#10878)
### Motivation
The java-instance.jar generated by the pulsar-functions-runtime-all module should only contain interfaces that Pulsar Function's framework uses to interact with user code. The module should on have the following dependencies
1. pulsar-io-core
2. pulsar-functions-api
3. pulsar-client-api
4. slf4j-api
5. log4j-slf4j-impl
6. log4j-api
7. log4j-core
*Explain here the context, and why you're making that change. What is the problem you're trying to solve.*
### Modifications
Change dep pulsar-client-original to pulsar-client-api
Slight changes in the top level pom for what is included in all sub-modules so that additional deps don't land into java-instance.jar
There is also a fix for an issue introduced by apache/pulsar#9673. The thread context class loader was set incorrectly in ThreadRuntime.
### Future improvements
1. We should also add a test in the future to make sure external libraries don't get add accidentally this module and java-instance.jar
2. Rename the module "pulsar-functions-runtime-all" to something that describes its function better. The current name can be confusing
Motivation
org.apache.pulsar.functions.LocalRunnercurrently has several issues:In addition to fixing real bugs in LocalRunner, this change is important for improving the build and Pulsar GitHub Actions based CI.
One benefit is that it simplifies the building of Pulsar since it reduces the dependencies of pulsar-broker module since it gets rid of the usage of maven-antrun-plugin plugin for copying the .nar files and pulsar-functions-api-examples.jar file to
src/test/resources. This is needed so that it's possible to reuse binary artifacts in the Pulsar CI pipeline. For example, in the unit test jobs, it should be possible to reuse the binary artifacts that are built in a previous step instead of building everything withmvn clean installin each step. When it's possible to reuse binary artifacts, we can save about 15 minutes for each unit test and integration test build job in the GitHub Action based CI pipeline.Modifications
Make LocalRunner work properly with .nar files that aren't on the classpath
also support the previous choice of providing the implementation classes
on the Thread context classloader classpath
Pass nar file locations as system properties to tests:
Pass pulsar-io cassandra and twitter nar file locations as system properties
to tests
Pass pulsar-io-data-generator.nar and pulsar-functions-api-examples.jar
file locations as system properties to tests
Improve LocalRunner cleanup/shutdown which wasn't handled before.
Fix invalid test in PackagesApiTest
Make PulsarFunction tests and Sink/Source tests work with .nar files which
aren't on the classpath.
Extract FileServer in tests to simplify the test code