-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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-14048] [CdapIO] Add ConfigWrapper for building CDAP PluginConfigs #17051
Conversation
Codecov Report
@@ Coverage Diff @@
## master #17051 +/- ##
==========================================
+ Coverage 73.96% 74.03% +0.07%
==========================================
Files 671 679 +8
Lines 88245 89292 +1047
==========================================
+ Hits 65267 66110 +843
- Misses 21866 22079 +213
+ Partials 1112 1103 -9
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Run Java PreCommit |
Run Java PreCommit |
Run CommunityMetrics PreCommit |
3 similar comments
Run CommunityMetrics PreCommit |
Run CommunityMetrics PreCommit |
Run CommunityMetrics PreCommit |
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.
Thanks!
sdks/java/io/cdap/build.gradle
Outdated
|
||
allprojects { | ||
repositories { | ||
maven { url 'https://jitpack.io' } |
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.
Why was this needed ?
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.
This is a temporary solution until we deal with the vendored dependencies. (e.x. com.github.data-integrations:salesforce
)
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.
Should we wait till dependency issue is resolved before committing the code ?
How would this work for release Beam ? Sounds like this just builds a local SNAPSHOT jar and probably not good as a permanent dependency for Beam.
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 agree that it's better to wait for the plugins to be published in the Maven Central Repository.
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/ConfigWrapper.java
Show resolved
Hide resolved
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/ConfigWrapper.java
Show resolved
Hide resolved
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/PluginConfigInstantiationUtils.java
Show resolved
Hide resolved
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/PluginConfigInstantiationUtils.java
Outdated
Show resolved
Hide resolved
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/PluginConfigInstantiationUtils.java
Outdated
Show resolved
Hide resolved
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/PluginConfigInstantiationUtils.java
Outdated
Show resolved
Hide resolved
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/PluginConfigInstantiationUtils.java
Outdated
Show resolved
Hide resolved
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/PluginConfigInstantiationUtils.java
Show resolved
Hide resolved
retest this please |
Run Java PreCommit |
Run Python PreCommit |
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.
Thanks.
sdks/java/io/cdap/build.gradle
Outdated
|
||
allprojects { | ||
repositories { | ||
maven { url 'https://jitpack.io' } |
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.
Should we wait till dependency issue is resolved before committing the code ?
How would this work for release Beam ? Sounds like this just builds a local SNAPSHOT jar and probably not good as a permanent dependency for Beam.
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/PluginConfigInstantiationUtils.java
Outdated
Show resolved
Hide resolved
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/PluginConfigInstantiationUtils.java
Outdated
Show resolved
Hide resolved
Run CommunityMetrics PreCommit |
…M-14048-cdap-config # Conflicts: # sdks/java/io/cdap/build.gradle
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.
Thanks. LGTM.
Resolves #24961
CDAP plugins use their own configuration classes (ex.
SalesforceSourceConfig
,SalesforceStreamingSourceConfig
) to set the required parameters to prepare and run pipeline in Source or Sink classes. All these config classes are extended from the baseio.cdap.cdap.api.plugin.PluginConfig
class.As a first step in integration of CDAP plugins and Apache Beam, there should be implemented a mechanism to create an instance of the specific
PluginConfig
implementation.For this purpose, suggested solution provides a
ConfigWrapper<T>
class. Apache Beam user creates an instance of this class by passing thePluginConfig
specific class as aT
parameter.ConfigWrapper<T>
object provides simple methods to instantiate the correspondingT
object:fromJsonFile(File file)
withParams(Map<String, Object> params)
setParam(String paramName, Object value)
build()
Apache Beam user could set required parameters for the CDAP plugin by passing the Map/JSON file or by manually setting each parameter.
After that, when the
build()
method was called, theConfigWrapper<T>
usesInstantiationUtils
, which in turn uses Reflection API.InstantiationUtils
class provides mechanisms for:PluginConfig
object bypassing the limitations of private constructors or the absence of no-args constructor.Field
s with thecdap.Name
annotation and setting the appropriate parameter values for them.As a result
ConfigWrapper<T>
returnsPluginConfig
object which can be further used when integrating with the corresponding plugin.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.CHANGES.md
with noteworthy changes.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)
See CI.md for more information about GitHub Actions CI.