public static Stage <ConsumerVertex, Epoch> MakeStage(int numberToConsume, int startProcess, int endProcess, int numberOfWorkers, bool exchange, Stream <Pair <int, int>, Epoch> stream) { var locations = new List <VertexLocation>(); for (int i = 0; i < endProcess - startProcess; i++) { for (int j = 0; j < numberOfWorkers; j++) { locations.Add(new VertexLocation(locations.Count, i + startProcess, j)); } } Placement placement = new Placement.Explicit(locations); Stage <ConsumerVertex, Epoch> stage = Foundry.NewStage(placement, stream.Context, (i, s) => new ConsumerVertex(i, s, numberToConsume), "Consumer"); if (exchange) { stage.NewInput(stream, (m, v) => v.OnRecv(m), x => x.Second); } else { stage.NewInput(stream, (m, v) => v.OnRecv(m), x => x.First); } return(stage); }
public static Stage <ConsumerVertex, Epoch> MakeStage(int numberToConsume, int numberOfPartitions, Stream <int, Epoch> stream) { Placement placement = new Placement.Explicit(Enumerable.Range(0, numberOfPartitions).Select(x => new VertexLocation(x, 1, x))); Stage <ConsumerVertex, Epoch> stage = Foundry.NewStage(placement, stream.Context, (i, s) => new ConsumerVertex(i, s, numberToConsume), "Consumer"); stage.NewInput(stream, (m, v) => v.OnRecv(m), x => x); return(stage); }
public static Stream <int, Epoch> MakeStage(int numberToSend, int numberOfPartitions, Stream <int, Epoch> input) { Placement placement = new Placement.Explicit(Enumerable.Range(0, numberOfPartitions).Select(x => new VertexLocation(x, 0, x))); Stage <ProducerVertex, Epoch> stage = Foundry.NewStage(placement, input.Context, (i, s) => new ProducerVertex(i, s, numberToSend), "Producer"); stage.NewInput(input, (v, m) => { }, null); Stream <int, Epoch> stream = stage.NewOutput(v => v.output); return(stream); }
public static Stream <Pair <int, int>, Epoch> MakeStage(int numberToSend, int startProcess, int endProcess, int numberOfWorkers, Stream <Pair <int, int>, Epoch> input) { var locations = new List <VertexLocation>(); for (int i = 0; i < endProcess - startProcess; i++) { for (int j = 0; j < numberOfWorkers; j++) { locations.Add(new VertexLocation(locations.Count, i + startProcess, j)); } } Placement placement = new Placement.Explicit(locations); Stage <ProducerVertex, Epoch> stage = Foundry.NewStage(placement, input.Context, (i, s) => new ProducerVertex(i, s, numberToSend), "Producer"); stage.NewInput(input, (v, m) => { }, null); Stream <Pair <int, int>, Epoch> stream = stage.NewOutput(v => v.output); return(stream); }