/** * Gets the iteration aggregator registered under the given name. The iteration aggregator combines * all aggregates globally once per superstep and makes them available in the next superstep. * * @param name The name of the aggregator. * @return The aggregator registered under this name, or null, if no aggregator was registered. */ public <T extends Aggregator<?>> T getIterationAggregator(String name) { return this.runtimeContext.getIterationAggregator(name); }
/** * Gets the number of the superstep, starting at <tt>1</tt>. * * @return The number of the current superstep. */ public final int getSuperstepNumber() { return this.runtimeContext.getSuperstepNumber(); }
/** * Get the aggregated value that an aggregator computed in the previous iteration. * * @param name The name of the aggregator. * @return The aggregated value of the previous iteration. */ public final <T extends Value> T getPreviousIterationAggregate(String name) { return this.runtimeContext.getPreviousIterationAggregate(name); }
@Override public void open(Configuration parameters) throws Exception { int currentIteration = getIterationRuntimeContext().getSuperstepNumber(); aggregator = getIterationRuntimeContext().getIterationAggregator(AGGREGATOR_NAME); if (currentIteration == 1) { danglingRankFactor = BETA * (double) numDanglingVertices / ((double) numVertices * (double) numVertices); } else { PageRankStats previousAggregate = getIterationRuntimeContext() .getPreviousIterationAggregate(AGGREGATOR_NAME); danglingRankFactor = BETA * previousAggregate.danglingRank() / (double) numVertices; } }
@Override public void open(Configuration conf) { final int superstep = getIterationRuntimeContext().getSuperstepNumber(); aggr = getIterationRuntimeContext().getIterationAggregator(aggName); if (superstep > 1 && getIterationRuntimeContext().getIndexOfThisSubtask() == 0) { LongValue val = getIterationRuntimeContext().getPreviousIterationAggregate(aggName); aggr_value[superstep - 2] = val.getValue(); } }
/** * Gets the broadcast data set registered under the given name. Broadcast data sets * are available on all parallel instances of a function. * * @param name The name under which the broadcast set is registered. * @return The broadcast data set. */ public <T> Collection<T> getBroadcastSet(String name) { return this.runtimeContext.getBroadcastVariable(name); }
@Override public void open(Configuration conf) { aggr = getIterationRuntimeContext().getIterationAggregator(NEGATIVE_ELEMENTS_AGGR); superstep = getIterationRuntimeContext().getSuperstepNumber(); if (superstep > 1) { previousAggr = getIterationRuntimeContext().getPreviousIterationAggregate(NEGATIVE_ELEMENTS_AGGR); // check previous aggregator value Assert.assertEquals(superstep - 1, previousAggr.getValue()); } }
/** * Gets the broadcast data set registered under the given name. Broadcast data sets * are available on all parallel instances of a function. They can be registered via * {@link org.apache.flink.graph.spargel.ScatterGatherConfiguration#addBroadcastSetForGatherFunction(String, org.apache.flink.api.java.DataSet)}. * * @param name The name under which the broadcast set is registered. * @return The broadcast data set. */ public <T> Collection<T> getBroadcastSet(String name) { return this.runtimeContext.getBroadcastVariable(name); }
/** * Gets the iteration aggregator registered under the given name. The iteration aggregator combines * all aggregates globally once per superstep and makes them available in the next superstep. * * @param name The name of the aggregator. * @return The aggregator registered under this name, or null, if no aggregator was registered. */ public <T extends Aggregator<?>> T getIterationAggregator(String name) { return this.runtimeContext.getIterationAggregator(name); }
@Override public void open(Configuration conf) { aggr = getIterationRuntimeContext().getIterationAggregator(NEGATIVE_ELEMENTS_AGGR); superstep = getIterationRuntimeContext().getSuperstepNumber(); if (superstep > 1) { previousAggr = getIterationRuntimeContext().getPreviousIterationAggregate(NEGATIVE_ELEMENTS_AGGR); // check previous aggregator value Assert.assertEquals(superstep - 1, previousAggr.getValue()); } }
/** * Gets the number of the superstep, starting at <tt>1</tt>. * * @return The number of the current superstep. */ public int getSuperstepNumber() { return this.runtimeContext.getSuperstepNumber(); }
/** * Get the aggregated value that an aggregator computed in the previous iteration. * * @param name The name of the aggregator. * @return The aggregated value of the previous iteration. */ public <T extends Value> T getPreviousIterationAggregate(String name) { return this.runtimeContext.getPreviousIterationAggregate(name); }
/** * Gets the broadcast data set registered under the given name. Broadcast data sets * are available on all parallel instances of a function. They can be registered via * {@link org.apache.flink.graph.pregel.VertexCentricConfiguration#addBroadcastSet(String, DataSet)}. * * @param name The name under which the broadcast set is registered. * @return The broadcast data set. */ public final <T> Collection<T> getBroadcastSet(String name) { return this.runtimeContext.getBroadcastVariable(name); }
/** * Gets the iteration aggregator registered under the given name. The iteration aggregator combines * all aggregates globally once per superstep and makes them available in the next superstep. * * @param name The name of the aggregator. * @return The aggregator registered under this name, or null, if no aggregator was registered. */ public <T extends Aggregator<?>> T getIterationAggregator(String name) { return this.runtimeContext.getIterationAggregator(name); }
when(mockedIterationRuntimeContext.getSuperstepNumber()).thenReturn(superstepNumber); function.setRuntimeContext(mockedIterationRuntimeContext); assertEquals(superstepNumber, iterationRuntimeContext.getSuperstepNumber()); iterationRuntimeContext.getIterationAggregator("foobar"); fail("Expected getIterationAggregator to fail with unsupported operation exception"); } catch (UnsupportedOperationException e) { iterationRuntimeContext.getPreviousIterationAggregate("foobar"); fail("Expected getPreviousIterationAggregator to fail with unsupported operation exception"); } catch (UnsupportedOperationException e) {
/** * Gets the number of the superstep, starting at <tt>1</tt>. * * @return The number of the current superstep. */ public int getSuperstepNumber() { return this.runtimeContext.getSuperstepNumber(); }
/** * Get the aggregated value that an aggregator computed in the previous iteration. * * @param name The name of the aggregator. * @return The aggregated value of the previous iteration. */ public <T extends Value> T getPreviousIterationAggregate(String name) { return this.runtimeContext.getPreviousIterationAggregate(name); }
/** * Gets the broadcast data set registered under the given name. Broadcast data sets * are available on all parallel instances of a function. * * @param name The name under which the broadcast set is registered. * @return The broadcast data set. */ public <T> Collection<T> getBroadcastSet(String name) { return this.runtimeContext.getBroadcastVariable(name); }
/** * Gets the iteration aggregator registered under the given name. The iteration aggregator combines * all aggregates globally once per superstep and makes them available in the next superstep. * * @param name The name of the aggregator. * @return The aggregator registered under this name, or null, if no aggregator was registered. */ public <T extends Aggregator<?>> T getIterationAggregator(String name) { return this.runtimeContext.getIterationAggregator(name); }
/** * Gets the number of the superstep, starting at <tt>1</tt>. * * @return The number of the current superstep. */ public int getSuperstepNumber() { return this.runtimeContext.getSuperstepNumber(); }