-
Notifications
You must be signed in to change notification settings - Fork 14
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
DSLSpout and bullet-core-0.6.5 #69
Conversation
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.
Need to add a setting to enable its usage and wire it in the Topology main class. Can we bump the version to 0.9.0?
@@ -0,0 +1,136 @@ | |||
/* | |||
* Copyright 2019, Verizon Media. |
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.
Use the same one as the rest of the project or at least Oath. This is not valid yet.
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 honestly didn't remember putting those in..
* | ||
* @param args A list of arguments where the first argument is expected to be the path to a configuration file. | ||
*/ | ||
public DSLSpout(List<String> args) { |
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 constructor isn't needed. Even for testing.
@Override | ||
public void nextTuple() { | ||
List<Object> objects = Collections.emptyList(); | ||
try { |
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.
Push to a different method.
} catch (BulletDSLException e) { | ||
log.error("Could not read from BulletConnector.", e); | ||
} | ||
long time = System.currentTimeMillis(); |
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 time is a in-between time from reading to converting. Can we make it pre-emission after all conversion? Or pre-reading? Or get a new time per emission?
} | ||
long time = System.currentTimeMillis(); | ||
for (Object object : objects) { | ||
try { |
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.
Push to a new method and can use streams with filters for non-null. Also the try catch just needs to be around the convert call.
|
||
@Override | ||
public void ack(Object id) { | ||
|
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.
Remove empty line here and below
* @param config Not used. | ||
*/ | ||
public MockConnector(BulletConfig config) { | ||
|
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.
Empty line
@@ -96,6 +97,11 @@ | |||
<artifactId>bullet-core</artifactId> | |||
<version>${bullet.core.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.yahoo.bullet</groupId> | |||
<artifactId>bullet-dsl</artifactId> |
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 will pull in kafka, pulsar and whatever else clients in the future. Can we use the DSL by having the jar at runtime and make it provided here? We need to try that out in storm.
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.
Ok. I've tried this out. A couple problems but works for the most part.
- I get a JNI error from the bullet-storm fat jar. I fixed this by making bullet-dsl "provided" and giving the jar to storm separately.
- There's a pulsar dependency in BulletDSLConfig. Oops.
- BulletConnector isn't serializable. Oops.
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.
Let's fix bullet-dsl before merging this then
What I'm thinking to enable DSLSpout in the main class:
Edit: why do we use command line args anyways? |
Maybe we shouldn't hijack bullet-spout to do the dsl plugin. Let's just make a set of different settings that are only used if dsl is enabled. We should also have a setting to separate using the BulletConnector in the DSLSpout and the BulletConvertor in a new DSLBolt. If this setting is false, we do both in the DSLSpout. |
.defaultTo(DEFAULT_DSL_SPOUT_ENABLE) | ||
.checkIf(Validator::isBoolean); | ||
VALIDATOR.define(DSL_SPOUT_PARALLELISM) | ||
.checkIf(Validator::isPositiveInt) |
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.
Indentation on these and below
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.
There's a reference to as a Spout (in which case, just use the {@link Topology#main(String[])} method with the class name of your Spout.
in the javadocs in StormUtils.java that is no longer applicable.
collector.emit(new Values(objects, System.currentTimeMillis()), DUMMY_ID); | ||
return; | ||
} | ||
objects.forEach(this::convertAndEmit); |
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.
Can do collector.emit(new Values(dslBoltEnable ? objects : convert(objects), System.currentTimeMillis()), DUMMY_ID);
and change convertAndEmit
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.
My bad. List emit vs object emit
} | ||
|
||
/** | ||
* This submits a topology after loading the given spout with the given configuration as the source of | ||
* {@link com.yahoo.bullet.record.BulletRecord}. | ||
* This submits a topology after loading the configured Spout (and optionally, bolt), which is either the {@link DSLSpout} |
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.
Capitalize bolt?
No description provided.