Skip to content

Conversation

houzhizhen
Copy link
Contributor

add option MESSAGE_CLASS, Sender and Receiver process compute message with type MESSAGE_CLASS
delete ValueFactory, move the method in ValueFactory to GraphFactory

return createValue(type);
}

// Can reuse Value
Copy link
Contributor

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

Copy link
Contributor Author

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);
Copy link
Contributor

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);

Copy link
Contributor Author

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to writeValue

Copy link
Contributor Author

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link

codecov bot commented Jun 21, 2021

Codecov Report

Merging #63 (62037f3) into master (ea4c743) will increase coverage by 0.08%.
The diff coverage is 92.42%.

Impacted file tree graph

@@ 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 
Impacted Files Coverage Δ
...aidu/hugegraph/computer/core/config/HotConfig.java 100.00% <ø> (+6.25%) ⬆️
...h/computer/core/receiver/MessageRecvPartition.java 81.42% <ø> (+2.26%) ⬆️
...graph/computer/core/graph/BuiltinGraphFactory.java 91.17% <82.35%> (-8.83%) ⬇️
...egraph/computer/core/io/JsonStructGraphOutput.java 93.97% <87.50%> (+0.22%) ⬆️
...u/hugegraph/computer/core/io/StreamGraphInput.java 97.40% <94.44%> (+5.51%) ⬆️
...ugegraph/computer/core/common/ComputerContext.java 100.00% <100.00%> (ø)
...hugegraph/computer/core/graph/value/ListValue.java 96.20% <100.00%> (-0.05%) ⬇️
...hugegraph/computer/core/graph/value/ValueType.java 91.30% <100.00%> (-0.37%) ⬇️
...ph/computer/core/aggregator/DefaultAggregator.java 82.85% <100.00%> (ø)
...ugegraph/computer/core/config/ComputerOptions.java 99.47% <100.00%> (-0.01%) ⬇️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea4c743...62037f3. Read the comment docs.

@Override
public ValueType valueType() {
return this.hotConfig.valueType();
if (this.computation == null) {
Copy link
Contributor

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?

Copy link
Contributor Author

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);
Copy link
Contributor

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

Copy link
Contributor Author

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.",
Copy link
Contributor

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

Copy link
Contributor Author

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",
Copy link
Contributor

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?

Copy link
Contributor Author

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);
Copy link
Contributor

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

Copy link
Contributor Author

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve var name

Copy link
Contributor Author

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());
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@Linary Linary merged commit 429e081 into master Jun 22, 2021
@Linary Linary deleted the message branch June 22, 2021 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants