- Notifications
You must be signed in to change notification settings - Fork 44
add option MESSAGE_CLASS, Sender and Receiver process compute message with type MESSAGE_CLASS #63
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
computer-core/src/main/java/com/baidu/hugegraph/computer/core/config/ComputerOptions.java Outdated Show resolved Hide resolved
return createValue(type); | ||
} | ||
| ||
// Can reuse Value |
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.
move to line 151, add TODO
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.
update with "Create property value by type."
| ||
private Value<?> readValue(RandomAccessInput in) throws IOException { | ||
private Value<?> readMessage(RandomAccessInput in) throws IOException { | ||
Value<?> v = this.config.createObject(ComputerOptions.MESSAGE_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.
also add createObject(String class) to GraphFactory? and then call graphFactory.createObject(ComputerOptions.MESSAGE_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.
No need.
value.write(out); | ||
} | ||
| ||
private void writeMessage(RandomAccessOutput out, Value<?> value) |
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.
rename to writeValue
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.
Both writeValue and writeMessage reserved, and it writes code in writeValue while does not in writeMessage.
Id id = graphInput.readMessage().getKey(); | ||
input.seek(position); | ||
return id; | ||
return StreamGraphInput.readId(input); |
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.
the StreamGraphInput.readId() is changed to static method?
the old code a id is prefix with bytes length, ensure it's expected now.
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.
StreamGraphOutput doesn't write bytes length, only EntryOutput write length first.
Codecov Report
@@ Coverage Diff @@ ## master #63 +/- ## ============================================ + Coverage 87.73% 87.81% +0.08% + Complexity 2087 2083 -4 ============================================ Files 226 225 -1 Lines 7100 7083 -17 Branches 577 576 -1 ============================================ - Hits 6229 6220 -9 + Misses 573 566 -7 + Partials 298 297 -1
Continue to review full report at Codecov.
|
@Override | ||
public ValueType valueType() { | ||
return this.hotConfig.valueType(); | ||
if (this.computation == null) { |
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 init this.computation
at ctor?
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.
Done
this.writeSplitter(); | ||
| ||
String valueName = this.config.vertexValueName(); | ||
String valueName = this.config.get(ComputerOptions.OUTPUT_VALUE_NAME); |
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.
define as a field to avoid fetching from config every time
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.
Done
"CUSTOM_VALUE.", | ||
"algorithm.result_class", | ||
"The class of vertex's value, the instance is used to " + | ||
"store computation result for the vertex.", |
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.
computation result of each vertex
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.
"computation result for the vertex" is more appropriate.
| ||
public static final ConfigOption<String> OUTPUT_VALUE_NAME = | ||
new ConfigOption<>( | ||
"output.value_name", |
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.
also rename to result_name?
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.
Done
case LIST_VALUE: | ||
return new ListValue<>(); | ||
case CUSTOM_VALUE: | ||
return this.config.createObject(ComputerOptions.VALUE_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.
prefer to keep the feature
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.
No need, all type of property are builtin.
int busyClientCount = 0; | ||
for (WorkerChannel channel : channels) { | ||
// The channel can't be null in online environment. | ||
if (channel == null) { |
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.
when the channel is null?
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.
In test case QueuedMessageSenderTest#testInitAndClose
| ||
@Test | ||
public void testPutAndTakeWithHungry() throws InterruptedException { | ||
public void testPutAndTakeWithPutAtFront() throws InterruptedException { |
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.
PutAtFront means what? is it testPutAtFront?
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.
queue.putAtFront
try { | ||
putLatch.await(); | ||
latches[0].countDown(); | ||
QueuedMessage m1 = queue.take(); |
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.
improve var name
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.
Done
public static void setup() throws ClassNotFoundException { | ||
LOG.info("Setup for UnitTestSuite of hugegraph-computer"); | ||
| ||
Class.forName(IdType.class.getName()); |
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.
any better way to load it?
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.
Removed
add option MESSAGE_CLASS, Sender and Receiver process compute message with type MESSAGE_CLASS
delete ValueFactory, move the method in ValueFactory to GraphFactory