當前位置: 首頁>>代碼示例>>Java>>正文


Java ExecutionVertex類代碼示例

本文整理匯總了Java中org.apache.flink.runtime.executiongraph.ExecutionVertex的典型用法代碼示例。如果您正苦於以下問題:Java ExecutionVertex類的具體用法?Java ExecutionVertex怎麽用?Java ExecutionVertex使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ExecutionVertex類屬於org.apache.flink.runtime.executiongraph包,在下文中一共展示了ExecutionVertex類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testTriggerStackTraceSampleNotRunningTasks

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
/** Tests triggering for non-running tasks fails the future. */
@Test
public void testTriggerStackTraceSampleNotRunningTasks() throws Exception {
	ExecutionVertex[] vertices = new ExecutionVertex[] {
			mockExecutionVertex(new ExecutionAttemptID(), ExecutionState.RUNNING, true),
			mockExecutionVertex(new ExecutionAttemptID(), ExecutionState.DEPLOYING, true)
	};

	CompletableFuture<StackTraceSample> sampleFuture = coord.triggerStackTraceSample(
		vertices,
		1,
		Time.milliseconds(100L),
		0);

	assertTrue(sampleFuture.isDone());

	try {
		sampleFuture.get();
		fail("Expected exception.");
	} catch (ExecutionException e) {
		assertTrue(e.getCause() instanceof IllegalStateException);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:24,代碼來源:StackTraceSampleCoordinatorTest.java

示例2: testTriggerStackTraceSampleResetRunningTasks

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
/** Tests triggering for reset tasks fails the future. */
@Test(timeout = 1000L)
public void testTriggerStackTraceSampleResetRunningTasks() throws Exception {
	ExecutionVertex[] vertices = new ExecutionVertex[] {
			mockExecutionVertex(new ExecutionAttemptID(), ExecutionState.RUNNING, true),
			// Fails to send the message to the execution (happens when execution is reset)
			mockExecutionVertex(new ExecutionAttemptID(), ExecutionState.RUNNING, false)
	};

	CompletableFuture<StackTraceSample> sampleFuture = coord.triggerStackTraceSample(
		vertices,
		1,
		Time.milliseconds(100L),
		0);

	try {
		sampleFuture.get();
		fail("Expected exception.");
	} catch (ExecutionException e) {
		assertTrue(e.getCause() instanceof RuntimeException);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:23,代碼來源:StackTraceSampleCoordinatorTest.java

示例3: testCancelStackTraceSample

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
/** Tests cancelling of a pending sample. */
@Test
public void testCancelStackTraceSample() throws Exception {
	ExecutionVertex[] vertices = new ExecutionVertex[] {
			mockExecutionVertex(new ExecutionAttemptID(), ExecutionState.RUNNING, true),
	};

	CompletableFuture<StackTraceSample> sampleFuture = coord.triggerStackTraceSample(
			vertices, 1, Time.milliseconds(100L), 0);

	assertFalse(sampleFuture.isDone());

	// Cancel
	coord.cancelStackTraceSample(0, null);

	// Verify completed
	assertTrue(sampleFuture.isDone());

	// Verify no more pending samples
	assertEquals(0, coord.getNumberOfPendingSamples());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:22,代碼來源:StackTraceSampleCoordinatorTest.java

示例4: testCollectStackTraceForCanceledSample

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
/** Tests that collecting for a cancelled sample throws no Exception. */
@Test
public void testCollectStackTraceForCanceledSample() throws Exception {
	ExecutionVertex[] vertices = new ExecutionVertex[] {
			mockExecutionVertex(new ExecutionAttemptID(), ExecutionState.RUNNING, true),
	};

	CompletableFuture<StackTraceSample> sampleFuture = coord.triggerStackTraceSample(
			vertices, 1, Time.milliseconds(100L), 0);

	assertFalse(sampleFuture.isDone());

	coord.cancelStackTraceSample(0, null);

	assertTrue(sampleFuture.isDone());

	// Verify no error on late collect
	ExecutionAttemptID executionId = vertices[0].getCurrentExecutionAttempt().getAttemptId();
	coord.collectStackTraces(0, executionId, new ArrayList<StackTraceElement[]>());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:21,代碼來源:StackTraceSampleCoordinatorTest.java

示例5: testCollectForDiscardedPendingSample

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
/** Tests that collecting for a cancelled sample throws no Exception. */
@Test
public void testCollectForDiscardedPendingSample() throws Exception {
	ExecutionVertex[] vertices = new ExecutionVertex[] {
			mockExecutionVertex(new ExecutionAttemptID(), ExecutionState.RUNNING, true),
	};

	CompletableFuture<StackTraceSample> sampleFuture = coord.triggerStackTraceSample(
			vertices, 1, Time.milliseconds(100L), 0);

	assertFalse(sampleFuture.isDone());

	coord.cancelStackTraceSample(0, null);

	assertTrue(sampleFuture.isDone());

	// Verify no error on late collect
	ExecutionAttemptID executionId = vertices[0].getCurrentExecutionAttempt().getAttemptId();
	coord.collectStackTraces(0, executionId, new ArrayList<StackTraceElement[]>());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:21,代碼來源:StackTraceSampleCoordinatorTest.java

示例6: mockExecutionVertex

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
private ExecutionVertex mockExecutionVertex(
		ExecutionAttemptID executionId,
		ExecutionState state,
		boolean sendSuccess) {

	Execution exec = mock(Execution.class);
	CompletableFuture<StackTraceSampleResponse> failedFuture = new CompletableFuture<>();
	failedFuture.completeExceptionally(new Exception("Send failed."));

	when(exec.getAttemptId()).thenReturn(executionId);
	when(exec.getState()).thenReturn(state);
	when(exec.requestStackTraceSample(anyInt(), anyInt(), any(Time.class), anyInt(), any(Time.class)))
		.thenReturn(
			sendSuccess ?
				CompletableFuture.completedFuture(mock(StackTraceSampleResponse.class)) :
				failedFuture);

	ExecutionVertex vertex = mock(ExecutionVertex.class);
	when(vertex.getJobvertexId()).thenReturn(new JobVertexID());
	when(vertex.getCurrentExecutionAttempt()).thenReturn(exec);

	return vertex;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:24,代碼來源:StackTraceSampleCoordinatorTest.java

示例7: mockExecutionVertex

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
private ExecutionVertex mockExecutionVertex(
		ExecutionJobVertex jobVertex,
		int subTaskIndex) {

	Execution exec = mock(Execution.class);
	when(exec.getAttemptId()).thenReturn(new ExecutionAttemptID());

	JobVertexID id = jobVertex.getJobVertexId();

	ExecutionVertex vertex = mock(ExecutionVertex.class);
	when(vertex.getJobvertexId()).thenReturn(id);
	when(vertex.getCurrentExecutionAttempt()).thenReturn(exec);
	when(vertex.getParallelSubtaskIndex()).thenReturn(subTaskIndex);

	return vertex;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:17,代碼來源:BackPressureStatsTrackerTest.java

示例8: PendingCheckpoint

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
public PendingCheckpoint(
		JobID jobId,
		long checkpointId,
		long checkpointTimestamp,
		Map<ExecutionAttemptID, ExecutionVertex> verticesToConfirm,
		CheckpointProperties props,
		CheckpointStorageLocation targetLocation,
		Executor executor) {

	checkArgument(verticesToConfirm.size() > 0,
			"Checkpoint needs at least one vertex that commits the checkpoint");

	this.jobId = checkNotNull(jobId);
	this.checkpointId = checkpointId;
	this.checkpointTimestamp = checkpointTimestamp;
	this.notYetAcknowledgedTasks = checkNotNull(verticesToConfirm);
	this.props = checkNotNull(props);
	this.targetLocation = checkNotNull(targetLocation);
	this.executor = Preconditions.checkNotNull(executor);

	this.operatorStates = new HashMap<>();
	this.masterState = new ArrayList<>();
	this.acknowledgedTasks = new HashSet<>(verticesToConfirm.size());
	this.onCompletionPromise = new CompletableFuture<>();
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:26,代碼來源:PendingCheckpoint.java

示例9: onTaskFailure

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
@Override
public void onTaskFailure(Execution taskExecution, Throwable cause) {
	final ExecutionVertex ev = taskExecution.getVertex();
	final FailoverRegion failoverRegion = vertexToRegion.get(ev);

	if (failoverRegion == null) {
		executionGraph.failGlobal(new FlinkException(
				"Can not find a failover region for the execution " + ev.getTaskNameWithSubtaskIndex(), cause));
	}
	else {
		LOG.info("Recovering task failure for {} #{} ({}) via restart of failover region",
				taskExecution.getVertex().getTaskNameWithSubtaskIndex(),
				taskExecution.getAttemptNumber(),
				taskExecution.getAttemptId());

		failoverRegion.onExecutionFail(taskExecution, cause);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:19,代碼來源:RestartPipelinedRegionStrategy.java

示例10: mockExecutionVertex

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
private static ExecutionVertex mockExecutionVertex(ExecutionState state, ResourceID resourceId) {
	ExecutionVertex vertex = mock(ExecutionVertex.class);

	Execution exec = mock(Execution.class);
	when(exec.getState()).thenReturn(state);
	when(exec.getAttemptId()).thenReturn(new ExecutionAttemptID());

	if (resourceId != null) {
		LogicalSlot slot = mockSlot(resourceId);
		when(exec.getAssignedResource()).thenReturn(slot);
		when(vertex.getCurrentAssignedResource()).thenReturn(slot);
	} else {
		when(exec.getAssignedResource()).thenReturn(null); // no resource
		when(vertex.getCurrentAssignedResource()).thenReturn(null);
	}

	when(vertex.getCurrentExecutionAttempt()).thenReturn(exec);

	return vertex;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:21,代碼來源:InputChannelDeploymentDescriptorTest.java

示例11: verifyExternalizedCheckpointRestore

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
private void verifyExternalizedCheckpointRestore(
		CompletedCheckpoint checkpoint,
		Map<JobVertexID, ExecutionJobVertex> jobVertices,
		ExecutionVertex... vertices) throws IOException {

	String pointer = checkpoint.getExternalPointer();
	StreamStateHandle metadataHandle = new FsStateBackend(tmp.getRoot().toURI()).resolveCheckpoint(pointer);

	CompletedCheckpoint loaded = Checkpoints.loadAndValidateCheckpoint(
			checkpoint.getJobId(),
			jobVertices,
			checkpoint.getExternalPointer(),
			metadataHandle,
			Thread.currentThread().getContextClassLoader(),
			false);

	for (ExecutionVertex vertex : vertices) {
		for (OperatorID operatorID : vertex.getJobVertex().getOperatorIDs()) {
			assertEquals(checkpoint.getOperatorStates().get(operatorID), loaded.getOperatorStates().get(operatorID));
		}
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:23,代碼來源:CheckpointExternalResumeTest.java

示例12: verifyExternalizedCheckpointRestore

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
private static void verifyExternalizedCheckpointRestore(
		CompletedCheckpoint checkpoint,
		Map<JobVertexID, ExecutionJobVertex> jobVertices,
		ExecutionVertex... vertices) throws IOException {

	CompletedCheckpoint loaded = SavepointLoader.loadAndValidateSavepoint(
			checkpoint.getJobId(),
			jobVertices,
			checkpoint.getExternalPointer(),
			Thread.currentThread().getContextClassLoader(),
			false);

	for (ExecutionVertex vertex : vertices) {
		for (OperatorID operatorID : vertex.getJobVertex().getOperatorIDs()) {
			assertEquals(checkpoint.getOperatorStates().get(operatorID), loaded.getOperatorStates().get(operatorID));
		}
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:19,代碼來源:CheckpointCoordinatorExternalizedCheckpointsTest.java

示例13: createPendingCheckpoint

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
private PendingCheckpoint createPendingCheckpoint(CheckpointProperties props, Executor executor) throws IOException {

		final Path checkpointDir = new Path(tmpFolder.newFolder().toURI());
		final FsCheckpointStorageLocation location = new FsCheckpointStorageLocation(
				LocalFileSystem.getSharedInstance(), checkpointDir, checkpointDir, checkpointDir);

		final Map<ExecutionAttemptID, ExecutionVertex> ackTasks = new HashMap<>(ACK_TASKS);

		return new PendingCheckpoint(
			new JobID(),
			0,
			1,
			ackTasks,
			props,
			location,
			executor);
	}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:18,代碼來源:PendingCheckpointTest.java

示例14: instantiateCheckpointCoordinator

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
private static CheckpointCoordinator instantiateCheckpointCoordinator(JobID jid, ExecutionVertex... ackVertices) {
	return new CheckpointCoordinator(
			jid,
			10000000L,
			600000L,
			0L,
			1,
			CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION,
			new ExecutionVertex[0],
			ackVertices,
			new ExecutionVertex[0],
			new StandaloneCheckpointIDCounter(),
			new StandaloneCompletedCheckpointStore(10),
			new MemoryStateBackend(),
			Executors.directExecutor(),
			SharedStateRegistry.DEFAULT_FACTORY);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:18,代碼來源:CheckpointCoordinatorMasterHooksTest.java

示例15: testTriggerStackTraceSampleNotRunningTasks

import org.apache.flink.runtime.executiongraph.ExecutionVertex; //導入依賴的package包/類
/** Tests triggering for non-running tasks fails the future. */
@Test
public void testTriggerStackTraceSampleNotRunningTasks() throws Exception {
	ExecutionVertex[] vertices = new ExecutionVertex[] {
			mockExecutionVertex(new ExecutionAttemptID(), ExecutionState.RUNNING, true),
			mockExecutionVertex(new ExecutionAttemptID(), ExecutionState.DEPLOYING, true)
	};

	CompletableFuture<StackTraceSample> sampleFuture = coord.triggerStackTraceSample(
		vertices,
		1,
		Time.milliseconds(100L),
		0);

	Assert.assertTrue(sampleFuture.isDone());

	try {
		sampleFuture.get();
		Assert.fail("Expected exception.");
	} catch (ExecutionException e) {
		Assert.assertTrue(e.getCause() instanceof IllegalStateException);
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:24,代碼來源:StackTraceSampleCoordinatorTest.java


注:本文中的org.apache.flink.runtime.executiongraph.ExecutionVertex類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。