org.apache.flink.runtime.iterative.concurrent.SuperstepKickoffLatch Java Examples

The following examples show how to use org.apache.flink.runtime.iterative.concurrent.SuperstepKickoffLatch. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IterationIntermediateTask.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void run() throws Exception {

	SuperstepKickoffLatch nextSuperstepLatch = SuperstepKickoffLatchBroker.instance().get(brokerKey());

	while (this.running && !terminationRequested()) {

		if (log.isInfoEnabled()) {
			log.info(formatLogString("starting iteration [" + currentIteration() + "]"));
		}

		super.run();

		// check if termination was requested
		verifyEndOfSuperstepState();

		if (isWorksetUpdate && isWorksetIteration) {
			long numCollected = worksetUpdateOutputCollector.getElementsCollectedAndReset();
			worksetAggregator.aggregate(numCollected);
		}

		if (log.isInfoEnabled()) {
			log.info(formatLogString("finishing iteration [" + currentIteration() + "]"));
		}

		// let the successors know that the end of this superstep data is reached
		sendEndOfSuperstep();

		if (isWorksetUpdate) {
			// notify iteration head if responsible for workset update
			worksetBackChannel.notifyOfEndOfSuperstep();
		}

		boolean terminated = nextSuperstepLatch.awaitStartOfSuperstepOrTermination(currentIteration() + 1);

		if (terminated) {
			requestTermination();
		}
		else {
			incrementIterationCounter();
		}
	}
}
 
Example #2
Source File: IterationTailTask.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void run() throws Exception {

	SuperstepKickoffLatch nextSuperStepLatch = SuperstepKickoffLatchBroker.instance().get(brokerKey());

	while (this.running && !terminationRequested()) {

		if (log.isInfoEnabled()) {
			log.info(formatLogString("starting iteration [" + currentIteration() + "]"));
		}

		super.run();

		// check if termination was requested
		verifyEndOfSuperstepState();

		if (isWorksetUpdate && isWorksetIteration) {
			// aggregate workset update element count
			long numCollected = worksetUpdateOutputCollector.getElementsCollectedAndReset();
			worksetAggregator.aggregate(numCollected);

		}

		if (log.isInfoEnabled()) {
			log.info(formatLogString("finishing iteration [" + currentIteration() + "]"));
		}

		if (isWorksetUpdate) {
			// notify iteration head if responsible for workset update
			worksetBackChannel.notifyOfEndOfSuperstep();
		} else if (isSolutionSetUpdate) {
			// notify iteration head if responsible for solution set update
			solutionSetUpdateBarrier.notifySolutionSetUpdate();
		}

		boolean terminate = nextSuperStepLatch.awaitStartOfSuperstepOrTermination(currentIteration() + 1);
		if (terminate) {
			requestTermination();
		}
		else {
			incrementIterationCounter();
		}
	}
}
 
Example #3
Source File: IterationIntermediateTask.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void run() throws Exception {

	SuperstepKickoffLatch nextSuperstepLatch = SuperstepKickoffLatchBroker.instance().get(brokerKey());

	while (this.running && !terminationRequested()) {

		if (log.isInfoEnabled()) {
			log.info(formatLogString("starting iteration [" + currentIteration() + "]"));
		}

		super.run();

		// check if termination was requested
		verifyEndOfSuperstepState();

		if (isWorksetUpdate && isWorksetIteration) {
			long numCollected = worksetUpdateOutputCollector.getElementsCollectedAndReset();
			worksetAggregator.aggregate(numCollected);
		}

		if (log.isInfoEnabled()) {
			log.info(formatLogString("finishing iteration [" + currentIteration() + "]"));
		}

		// let the successors know that the end of this superstep data is reached
		sendEndOfSuperstep();

		if (isWorksetUpdate) {
			// notify iteration head if responsible for workset update
			worksetBackChannel.notifyOfEndOfSuperstep();
		}

		boolean terminated = nextSuperstepLatch.awaitStartOfSuperstepOrTermination(currentIteration() + 1);

		if (terminated) {
			requestTermination();
		}
		else {
			incrementIterationCounter();
		}
	}
}
 
Example #4
Source File: IterationTailTask.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void run() throws Exception {

	SuperstepKickoffLatch nextSuperStepLatch = SuperstepKickoffLatchBroker.instance().get(brokerKey());

	while (this.running && !terminationRequested()) {

		if (log.isInfoEnabled()) {
			log.info(formatLogString("starting iteration [" + currentIteration() + "]"));
		}

		super.run();

		// check if termination was requested
		verifyEndOfSuperstepState();

		if (isWorksetUpdate && isWorksetIteration) {
			// aggregate workset update element count
			long numCollected = worksetUpdateOutputCollector.getElementsCollectedAndReset();
			worksetAggregator.aggregate(numCollected);

		}

		if (log.isInfoEnabled()) {
			log.info(formatLogString("finishing iteration [" + currentIteration() + "]"));
		}

		if (isWorksetUpdate) {
			// notify iteration head if responsible for workset update
			worksetBackChannel.notifyOfEndOfSuperstep();
		} else if (isSolutionSetUpdate) {
			// notify iteration head if responsible for solution set update
			solutionSetUpdateBarrier.notifySolutionSetUpdate();
		}

		boolean terminate = nextSuperStepLatch.awaitStartOfSuperstepOrTermination(currentIteration() + 1);
		if (terminate) {
			requestTermination();
		}
		else {
			incrementIterationCounter();
		}
	}
}
 
Example #5
Source File: IterationIntermediateTask.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void run() throws Exception {

	SuperstepKickoffLatch nextSuperstepLatch = SuperstepKickoffLatchBroker.instance().get(brokerKey());

	while (this.running && !terminationRequested()) {

		if (log.isInfoEnabled()) {
			log.info(formatLogString("starting iteration [" + currentIteration() + "]"));
		}

		super.run();

		// check if termination was requested
		verifyEndOfSuperstepState();

		if (isWorksetUpdate && isWorksetIteration) {
			long numCollected = worksetUpdateOutputCollector.getElementsCollectedAndReset();
			worksetAggregator.aggregate(numCollected);
		}

		if (log.isInfoEnabled()) {
			log.info(formatLogString("finishing iteration [" + currentIteration() + "]"));
		}

		// let the successors know that the end of this superstep data is reached
		sendEndOfSuperstep();

		if (isWorksetUpdate) {
			// notify iteration head if responsible for workset update
			worksetBackChannel.notifyOfEndOfSuperstep();
		}

		boolean terminated = nextSuperstepLatch.awaitStartOfSuperstepOrTermination(currentIteration() + 1);

		if (terminated) {
			requestTermination();
		}
		else {
			incrementIterationCounter();
		}
	}
}
 
Example #6
Source File: IterationTailTask.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void run() throws Exception {

	SuperstepKickoffLatch nextSuperStepLatch = SuperstepKickoffLatchBroker.instance().get(brokerKey());

	while (this.running && !terminationRequested()) {

		if (log.isInfoEnabled()) {
			log.info(formatLogString("starting iteration [" + currentIteration() + "]"));
		}

		super.run();

		// check if termination was requested
		verifyEndOfSuperstepState();

		if (isWorksetUpdate && isWorksetIteration) {
			// aggregate workset update element count
			long numCollected = worksetUpdateOutputCollector.getElementsCollectedAndReset();
			worksetAggregator.aggregate(numCollected);

		}

		if (log.isInfoEnabled()) {
			log.info(formatLogString("finishing iteration [" + currentIteration() + "]"));
		}

		if (isWorksetUpdate) {
			// notify iteration head if responsible for workset update
			worksetBackChannel.notifyOfEndOfSuperstep();
		} else if (isSolutionSetUpdate) {
			// notify iteration head if responsible for solution set update
			solutionSetUpdateBarrier.notifySolutionSetUpdate();
		}

		boolean terminate = nextSuperStepLatch.awaitStartOfSuperstepOrTermination(currentIteration() + 1);
		if (terminate) {
			requestTermination();
		}
		else {
			incrementIterationCounter();
		}
	}
}