当前位置: 首页>>代码示例>>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;未经允许,请勿转载。