January 2020
Intermediate to advanced
640 pages
16h 56m
English
The workerStepBarrier type encapsulates the required logic for enabling a worker to enter the barrier for a particular graph execution step and to wait until the master notifies the worker that it can now exit the barrier.
The workerStepBarrier type is defined as follows:
type workerStepBarrier struct { ctx context.Context stream *remoteMasterStream waitCh map[proto.Step_Type]chan *proto.Step}To understand how these fields are initialized, let's take a look at the constructor for a new barrier instance:
func newWorkerStepBarrier(ctx context.Context, stream *remoteMasterStream) *workerStepBarrier { waitCh := make(map[proto.Step_Type]chan *proto.Step) for stepType := range proto.Step_Type_name ...