Skip to content

Conversation

houzhizhen
Copy link
Contributor

@houzhizhen houzhizhen commented May 13, 2021

unify bsp key to xxxDONE
master set workers info after all workers inited and assign worker id
add compute_done signal between master and workers for every superstep
worker set close_done signal after close the managers
worker signal bsp event BSP_WORKER_INIT_DONE with workerInfo.toString() instead of workerInfo.id()

@codecov
Copy link

codecov bot commented May 13, 2021

Codecov Report

Merging #48 (f2fb89b) into master (930f5dd) will increase coverage by 0.19%.
The diff coverage is 95.62%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #48 +/- ## ============================================ + Coverage 84.56% 84.76% +0.19%  - Complexity 1368 1384 +16  ============================================ Files 150 150 Lines 4530 4615 +85 Branches 376 378 +2 ============================================ + Hits 3831 3912 +81  - Misses 471 474 +3  - Partials 228 229 +1 
Impacted Files Coverage Δ Complexity Δ
...du/hugegraph/computer/core/util/SerializeUtil.java 70.00% <77.77%> (+8.46%) 6.00 <4.00> (+3.00)
.../baidu/hugegraph/computer/core/bsp/Bsp4Worker.java 97.43% <94.23%> (-2.57%) 17.00 <11.00> (+3.00) ⬇️
.../baidu/hugegraph/computer/core/bsp/Bsp4Master.java 100.00% <100.00%> (ø) 22.00 <13.00> (+6.00)
...om/baidu/hugegraph/computer/core/bsp/BspEvent.java 81.81% <100.00%> (+4.04%) 2.00 <0.00> (ø)
.../hugegraph/computer/core/common/ContainerInfo.java 95.12% <100.00%> (+1.37%) 17.00 <4.00> (+3.00)
.../hugegraph/computer/core/master/MasterService.java 89.38% <100.00%> (+0.28%) 15.00 <0.00> (ø)
.../hugegraph/computer/core/worker/WorkerService.java 88.18% <100.00%> (+0.33%) 13.00 <0.00> (ø)
...h/computer/core/network/session/ClientSession.java 91.66% <0.00%> (+3.57%) 23.00% <0.00%> (+1.00%)

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 930f5dd...f2fb89b. Read the comment docs.

LOG.info("Master waited all workers registered, workers: {}",
LOG.info("Master waited all workers init-done, workers: {}",
containers);
this.assignContainerId(containers);
Copy link
Contributor

Choose a reason for hiding this comment

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

rename assignIdForWorkers

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

* {@link #waitMasterAllInitDone()}.
*/
String path = this.constructPath(BspEvent.BSP_WORKER_INIT_DONE,
this.workerInfo.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

define tmpWorkerId = this.workerInfo.host+port and comment why it's ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

use uniqueName

LOG.info("Worker({}) waited master all-registered, workers: {}",
String path = this.constructPath(BspEvent.BSP_MASTER_ALL_INIT_DONE);
byte[] serializedContainers = this.bspClient().get(
path,
Copy link
Contributor

Choose a reason for hiding this comment

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

align

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 int waitMasterSuperstepResume() {
LOG.info("Worker({}) is waiting for master superstep-resume",
public int waitMasterResume() {
Copy link
Contributor

Choose a reason for hiding this comment

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

waitMasterResumeDone

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

if (this.workerInfo.equalsExceptId(container)) {
this.workerInfo.id(container.id());
LOG.info("Worker({}) assigned id {} from master",
this.workerInfo, this.workerInfo.id());
Copy link
Contributor

Choose a reason for hiding this comment

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

this.workerInfo.uniqueName()

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

// Note: The workerInfo in Bsp4Worker is the same object in WorkerService.
private void assignThisWorkerId(List<ContainerInfo> workersFromMaster) {
for (ContainerInfo container : workersFromMaster) {
if (this.workerInfo.equalsExceptId(container)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

compare this.workerInfo.uniqueName()

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.bsp4Master.masterStepComputeDone(superstep);
List<WorkerStat> workerStats =
this.bsp4Master.waitWorkersSuperstepDone(superstep);
this.bsp4Master.waitWorkersStepDone(superstep);
Copy link
Contributor

Choose a reason for hiding this comment

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

align with workerStats

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 <V extends Readable> List<V> fromBytes(byte[] bytes,
ObjectFactory<V> factory) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use Supplier<V>

BSP_WORKER_INIT_DONE(2, "/worker"),
BSP_MASTER_ALL_INIT_DONE(3, "/master/all_init_done"),
BSP_MASTER_RESUME(4, "/master/resume"),
BSP_MASTER_RESUME_DONE(4, "/master/resume"),
Copy link
Contributor

Choose a reason for hiding this comment

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

keep the same style: remove "_done" suffix

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.rpcPort == other.rpcPort &&
this.dataPort == other.dataPort;
public String uniqueName() {
return String.format("%s:%s", this.hostname, this.dataPort);
Copy link
Contributor

Choose a reason for hiding this comment

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

use stringbuilder

@houzhizhen houzhizhen changed the title refactor bsp Standardize bsp synchronize between master and worker May 13, 2021
@houzhizhen houzhizhen changed the title Standardize bsp synchronize between master and worker Standardize bsp synchronization between master and worker May 13, 2021
javeme
javeme previously approved these changes May 13, 2021
@Linary Linary merged commit a125f78 into master May 13, 2021
@Linary Linary deleted the bsp branch May 13, 2021 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants