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
[BEAM-3344] Changes for serialize/deserialize PipelineOptions via jackson in DirectRunner #8302
Conversation
R: @lukecwik |
retest this please |
Run Portable_Python PreCommit |
Run Java PreCommit |
|
||
/** Construct a {@link DirectRunner} from the provided options. */ | ||
public static DirectRunner fromOptions(PipelineOptions options) { | ||
options = MAPPER.convertValue(MAPPER.valueToTree(options), DirectOptions.class); |
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.
convertValue
/ valueToTree
may go through specialized paths which partially convert value types and allow for things like static references to stick around. Instead try using ObjectMapper#readValue and ObjectMapper#writeValues
Can you also add a unit test?
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.
@lukecwik Thanks for the suggestions.
Added changes as suggested and also added unit test for the same. Please review my changes.
retest this please |
@lukecwik Could you please review my pull request. |
Run Java PreCommit |
Run Portable_Python PreCommit |
runners/direct-java/src/main/java/org/apache/beam/runners/direct/DirectRunner.java
Outdated
Show resolved
Hide resolved
runners/direct-java/src/main/java/org/apache/beam/runners/direct/DirectRunner.java
Outdated
Show resolved
Hide resolved
runners/direct-java/src/main/java/org/apache/beam/runners/direct/DirectRunner.java
Outdated
Show resolved
Hide resolved
runners/direct-java/src/main/java/org/apache/beam/runners/direct/DirectRunner.java
Outdated
Show resolved
Hide resolved
runners/direct-java/src/test/java/org/apache/beam/runners/direct/DirectRunnerTest.java
Outdated
Show resolved
Hide resolved
runners/direct-java/src/test/java/org/apache/beam/runners/direct/DirectRunnerTest.java
Outdated
Show resolved
Hide resolved
runners/direct-java/src/test/java/org/apache/beam/runners/direct/DirectRunnerTest.java
Outdated
Show resolved
Hide resolved
runners/direct-java/src/test/java/org/apache/beam/runners/direct/DirectRunnerTest.java
Outdated
Show resolved
Hide resolved
runners/direct-java/src/test/java/org/apache/beam/runners/direct/DirectRunnerTest.java
Show resolved
Hide resolved
runners/direct-java/src/test/java/org/apache/beam/runners/direct/DirectRunnerTest.java
Show resolved
Hide resolved
All minor suggestions, please take a look and accept changes that you agree with. |
Run Java PreCommit |
Run Portable_Python PreCommit |
…ct/DirectRunner.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunner.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunner.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunner.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunnerTest.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunnerTest.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunnerTest.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunnerTest.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunnerTest.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunnerTest.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunnerTest.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunnerTest.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunnerTest.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
…ct/DirectRunnerTest.java Co-Authored-By: sudhan499 <sudhan499@gmail.com>
retest this please |
@lukecwik Thanks for the suggestions and time. I agree with all the changes you suggested and accepted them. |
Run Java PreCommit |
…s invoked to allow for the correct binding of RuntimeValueProvider to occur.
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 was looking into the test failure for the PR related to DatastoreV1Test and found that doing the serialization/deserialization at construction time instead of at run() causes the ValueProviders to become accessible which breaks all the tests that rely on checking ValueProviders not being set. I opened this PR against your repo with a fix. If you think this still addresses BEAM-3344, please merge my PR into your repo so that this PR gets updated and then we can make sure the tests are passing.
Migrate PipelineOptions serialization/deserialization till when run is invoked to allow for the correct binding of RuntimeValueProvider to occur.
Thanks, everything looks good and the tests passed. |
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.