org.apache.flink.runtime.checkpoint.JobManagerTaskRestore Java Examples

The following examples show how to use org.apache.flink.runtime.checkpoint.JobManagerTaskRestore. 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: RestoreStreamTaskTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreWithoutState() throws Exception {
	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new StatelessOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();
	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new StatelessOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #2
Source File: TaskDeploymentDescriptorFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
public TaskDeploymentDescriptor createDeploymentDescriptor(
		AllocationID allocationID,
		int targetSlotNumber,
		@Nullable JobManagerTaskRestore taskRestore,
		Collection<ResultPartitionDeploymentDescriptor> producedPartitions) {
	return new TaskDeploymentDescriptor(
		jobID,
		serializedJobInformation,
		taskInfo,
		executionId,
		allocationID,
		subtaskIndex,
		attemptNumber,
		targetSlotNumber,
		taskRestore,
		new ArrayList<>(producedPartitions),
		createInputGateDeploymentDescriptors());
}
 
Example #3
Source File: StatefulOperatorChainedTaskTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testMultipleStatefulOperatorChainedSnapshotAndRestore() throws Exception {

	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator("head"),
		tailOperatorID,
		new CounterOperator("tail"),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator("head"),
		tailOperatorID,
		new CounterOperator("tail"),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #4
Source File: RestoreStreamTaskTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreWithoutState() throws Exception {
	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new StatelessOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();
	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new StatelessOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #5
Source File: RestoreStreamTaskTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreTailWithNewId() throws Exception {
	OperatorID headOperatorID = new OperatorID(42L, 42L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		new OperatorID(44L, 44L),
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();
	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		new OperatorID(4444L, 4444L),
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(Collections.singleton(headOperatorID), RESTORED_OPERATORS);
}
 
Example #6
Source File: RestoreStreamTaskTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreHeadWithNewId() throws Exception {

	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		new OperatorID(42L, 42L),
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		new OperatorID(4242L, 4242L),
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(Collections.singleton(tailOperatorID), RESTORED_OPERATORS);
}
 
Example #7
Source File: RestoreStreamTaskTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestore() throws Exception {

	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #8
Source File: StatefulOperatorChainedTaskTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testMultipleStatefulOperatorChainedSnapshotAndRestore() throws Exception {

	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator("head"),
		tailOperatorID,
		new CounterOperator("tail"),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator("head"),
		tailOperatorID,
		new CounterOperator("tail"),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #9
Source File: TaskDeploymentDescriptorFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
public TaskDeploymentDescriptor createDeploymentDescriptor(
		AllocationID allocationID,
		int targetSlotNumber,
		@Nullable JobManagerTaskRestore taskRestore,
		Collection<ResultPartitionDeploymentDescriptor> producedPartitions) {
	return new TaskDeploymentDescriptor(
		jobID,
		serializedJobInformation,
		taskInfo,
		executionId,
		allocationID,
		subtaskIndex,
		attemptNumber,
		targetSlotNumber,
		taskRestore,
		new ArrayList<>(producedPartitions),
		createInputGateDeploymentDescriptors());
}
 
Example #10
Source File: StatefulOperatorChainedTaskTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testMultipleStatefulOperatorChainedSnapshotAndRestore() throws Exception {

	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator("head"),
		tailOperatorID,
		new CounterOperator("tail"),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator("head"),
		tailOperatorID,
		new CounterOperator("tail"),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #11
Source File: RestoreStreamTaskTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreWithoutState() throws Exception {
	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new StatelessOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();
	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new StatelessOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #12
Source File: RestoreStreamTaskTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreTailWithNewId() throws Exception {
	OperatorID headOperatorID = new OperatorID(42L, 42L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		new OperatorID(44L, 44L),
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();
	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		new OperatorID(4444L, 4444L),
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(Collections.singleton(headOperatorID), RESTORED_OPERATORS);
}
 
Example #13
Source File: RestoreStreamTaskTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestore() throws Exception {

	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #14
Source File: RestoreStreamTaskTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreHeadWithNewId() throws Exception {

	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		new OperatorID(42L, 42L),
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		new OperatorID(4242L, 4242L),
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(Collections.singleton(tailOperatorID), RESTORED_OPERATORS);
}
 
Example #15
Source File: RestoreStreamTaskTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreTailWithNewId() throws Exception {
	OperatorID headOperatorID = new OperatorID(42L, 42L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		new OperatorID(44L, 44L),
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();
	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		new OperatorID(4444L, 4444L),
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(Collections.singleton(headOperatorID), RESTORED_OPERATORS);
}
 
Example #16
Source File: RestoreStreamTaskTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestoreHeadWithNewId() throws Exception {

	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		new OperatorID(42L, 42L),
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		new OperatorID(4242L, 4242L),
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(Collections.singleton(tailOperatorID), RESTORED_OPERATORS);
}
 
Example #17
Source File: RestoreStreamTaskTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testRestore() throws Exception {

	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #18
Source File: TaskDeploymentDescriptor.java    From flink with Apache License 2.0 5 votes vote down vote up
public TaskDeploymentDescriptor(
	JobID jobId,
	MaybeOffloaded<JobInformation> serializedJobInformation,
	MaybeOffloaded<TaskInformation> serializedTaskInformation,
	ExecutionAttemptID executionAttemptId,
	AllocationID allocationId,
	int subtaskIndex,
	int attemptNumber,
	int targetSlotNumber,
	@Nullable JobManagerTaskRestore taskRestore,
	List<ResultPartitionDeploymentDescriptor> resultPartitionDeploymentDescriptors,
	List<InputGateDeploymentDescriptor> inputGateDeploymentDescriptors) {

	this.jobId = Preconditions.checkNotNull(jobId);

	this.serializedJobInformation = Preconditions.checkNotNull(serializedJobInformation);
	this.serializedTaskInformation = Preconditions.checkNotNull(serializedTaskInformation);

	this.executionId = Preconditions.checkNotNull(executionAttemptId);
	this.allocationId = Preconditions.checkNotNull(allocationId);

	Preconditions.checkArgument(0 <= subtaskIndex, "The subtask index must be positive.");
	this.subtaskIndex = subtaskIndex;

	Preconditions.checkArgument(0 <= attemptNumber, "The attempt number must be positive.");
	this.attemptNumber = attemptNumber;

	Preconditions.checkArgument(0 <= targetSlotNumber, "The target slot number must be positive.");
	this.targetSlotNumber = targetSlotNumber;

	this.taskRestore = taskRestore;

	this.producedPartitions = Preconditions.checkNotNull(resultPartitionDeploymentDescriptors);
	this.inputGates = Preconditions.checkNotNull(inputGateDeploymentDescriptors);
}
 
Example #19
Source File: TaskStateManagerImpl.java    From flink with Apache License 2.0 5 votes vote down vote up
public TaskStateManagerImpl(
		@Nonnull JobID jobId,
		@Nonnull ExecutionAttemptID executionAttemptID,
		@Nonnull TaskLocalStateStore localStateStore,
		@Nullable JobManagerTaskRestore jobManagerTaskRestore,
		@Nonnull CheckpointResponder checkpointResponder) {
	this(
		jobId,
		executionAttemptID,
		localStateStore,
		jobManagerTaskRestore,
		checkpointResponder,
		new ChannelStateReaderImpl(jobManagerTaskRestore == null ? new TaskStateSnapshot() : jobManagerTaskRestore.getTaskStateSnapshot())
	);
}
 
Example #20
Source File: TaskDeploymentDescriptor.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public TaskDeploymentDescriptor(
	JobID jobId,
	MaybeOffloaded<JobInformation> serializedJobInformation,
	MaybeOffloaded<TaskInformation> serializedTaskInformation,
	ExecutionAttemptID executionAttemptId,
	AllocationID allocationId,
	int subtaskIndex,
	int attemptNumber,
	int targetSlotNumber,
	@Nullable JobManagerTaskRestore taskRestore,
	Collection<ResultPartitionDeploymentDescriptor> resultPartitionDeploymentDescriptors,
	Collection<InputGateDeploymentDescriptor> inputGateDeploymentDescriptors) {

	this.jobId = Preconditions.checkNotNull(jobId);

	this.serializedJobInformation = Preconditions.checkNotNull(serializedJobInformation);
	this.serializedTaskInformation = Preconditions.checkNotNull(serializedTaskInformation);

	this.executionId = Preconditions.checkNotNull(executionAttemptId);
	this.allocationId = Preconditions.checkNotNull(allocationId);

	Preconditions.checkArgument(0 <= subtaskIndex, "The subtask index must be positive.");
	this.subtaskIndex = subtaskIndex;

	Preconditions.checkArgument(0 <= attemptNumber, "The attempt number must be positive.");
	this.attemptNumber = attemptNumber;

	Preconditions.checkArgument(0 <= targetSlotNumber, "The target slot number must be positive.");
	this.targetSlotNumber = targetSlotNumber;

	this.taskRestore = taskRestore;

	this.producedPartitions = Preconditions.checkNotNull(resultPartitionDeploymentDescriptors);
	this.inputGates = Preconditions.checkNotNull(inputGateDeploymentDescriptors);
}
 
Example #21
Source File: RestoreStreamTaskTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testRestoreAfterScaleUp() throws Exception {
	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	// test empty state in case of scale up
	OperatorSubtaskState emptyHeadOperatorState = StateAssignmentOperation.operatorSubtaskStateFrom(
		new OperatorInstanceID(0, headOperatorID),
		Collections.emptyMap(),
		Collections.emptyMap(),
		Collections.emptyMap(),
		Collections.emptyMap(),
		Collections.emptyMap(),
		Collections.emptyMap());

	stateHandles.putSubtaskStateByOperatorID(headOperatorID, emptyHeadOperatorState);

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #22
Source File: RestoreStreamTaskTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testRestoreAfterScaleUp() throws Exception {
	OperatorID headOperatorID = new OperatorID(42L, 42L);
	OperatorID tailOperatorID = new OperatorID(44L, 44L);

	JobManagerTaskRestore restore = createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.empty());

	TaskStateSnapshot stateHandles = restore.getTaskStateSnapshot();

	assertEquals(2, stateHandles.getSubtaskStateMappings().size());

	// test empty state in case of scale up
	OperatorSubtaskState emptyHeadOperatorState = StateAssignmentOperation.operatorSubtaskStateFrom(
		new OperatorInstanceID(0, headOperatorID),
		Collections.emptyMap(),
		Collections.emptyMap(),
		Collections.emptyMap(),
		Collections.emptyMap());

	stateHandles.putSubtaskStateByOperatorID(headOperatorID, emptyHeadOperatorState);

	createRunAndCheckpointOperatorChain(
		headOperatorID,
		new CounterOperator(),
		tailOperatorID,
		new CounterOperator(),
		Optional.of(restore));

	assertEquals(new HashSet<>(Arrays.asList(headOperatorID, tailOperatorID)), RESTORED_OPERATORS);
}
 
Example #23
Source File: TaskStateManagerImpl.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public TaskStateManagerImpl(
	@Nonnull JobID jobId,
	@Nonnull ExecutionAttemptID executionAttemptID,
	@Nonnull TaskLocalStateStore localStateStore,
	@Nullable JobManagerTaskRestore jobManagerTaskRestore,
	@Nonnull CheckpointResponder checkpointResponder) {

	this.jobId = jobId;
	this.localStateStore = localStateStore;
	this.jobManagerTaskRestore = jobManagerTaskRestore;
	this.executionAttemptID = executionAttemptID;
	this.checkpointResponder = checkpointResponder;
}
 
Example #24
Source File: TaskStateManagerImpl.java    From flink with Apache License 2.0 5 votes vote down vote up
public TaskStateManagerImpl(
		@Nonnull JobID jobId,
		@Nonnull ExecutionAttemptID executionAttemptID,
		@Nonnull TaskLocalStateStore localStateStore,
		@Nullable JobManagerTaskRestore jobManagerTaskRestore,
		@Nonnull CheckpointResponder checkpointResponder,
		@Nonnull ChannelStateReader channelStateReader) {
	this.jobId = jobId;
	this.localStateStore = localStateStore;
	this.jobManagerTaskRestore = jobManagerTaskRestore;
	this.executionAttemptID = executionAttemptID;
	this.checkpointResponder = checkpointResponder;
	this.channelStateReader = channelStateReader;
}
 
Example #25
Source File: ExecutionTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that the task restore state is nulled after the {@link Execution} has been
 * deployed. See FLINK-9693.
 */
@Test
public void testTaskRestoreStateIsNulledAfterDeployment() throws Exception {
	final JobVertex jobVertex = createNoOpJobVertex();
	final JobVertexID jobVertexId = jobVertex.getID();

	final SingleSlotTestingSlotOwner slotOwner = new SingleSlotTestingSlotOwner();
	final ProgrammedSlotProvider slotProvider = createProgrammedSlotProvider(
		1,
		Collections.singleton(jobVertexId),
		slotOwner);

	ExecutionGraph executionGraph = ExecutionGraphTestUtils.createSimpleTestGraph(
		new JobID(),
		slotProvider,
		new NoRestartStrategy(),
		jobVertex);

	ExecutionJobVertex executionJobVertex = executionGraph.getJobVertex(jobVertexId);

	ExecutionVertex executionVertex = executionJobVertex.getTaskVertices()[0];

	final Execution execution = executionVertex.getCurrentExecutionAttempt();

	final JobManagerTaskRestore taskRestoreState = new JobManagerTaskRestore(1L, new TaskStateSnapshot());
	execution.setInitialState(taskRestoreState);

	assertThat(execution.getTaskRestore(), is(notNullValue()));

	// schedule the execution vertex and wait for its deployment
	executionVertex.scheduleForExecution(
		executionGraph.getSlotProviderStrategy(),
		LocationPreferenceConstraint.ANY,
		Collections.emptySet())
		.get();

	assertThat(execution.getTaskRestore(), is(nullValue()));
}
 
Example #26
Source File: TaskStateManagerImplTest.java    From flink with Apache License 2.0 5 votes vote down vote up
public static TaskStateManager taskStateManager(
	JobID jobID,
	ExecutionAttemptID executionAttemptID,
	CheckpointResponder checkpointResponderMock,
	JobManagerTaskRestore jobManagerTaskRestore,
	TaskLocalStateStore localStateStore) {

	return new TaskStateManagerImpl(
		jobID,
		executionAttemptID,
		localStateStore,
		jobManagerTaskRestore,
		checkpointResponderMock);
}
 
Example #27
Source File: TaskStateManagerImpl.java    From flink with Apache License 2.0 5 votes vote down vote up
public TaskStateManagerImpl(
	@Nonnull JobID jobId,
	@Nonnull ExecutionAttemptID executionAttemptID,
	@Nonnull TaskLocalStateStore localStateStore,
	@Nullable JobManagerTaskRestore jobManagerTaskRestore,
	@Nonnull CheckpointResponder checkpointResponder) {

	this.jobId = jobId;
	this.localStateStore = localStateStore;
	this.jobManagerTaskRestore = jobManagerTaskRestore;
	this.executionAttemptID = executionAttemptID;
	this.checkpointResponder = checkpointResponder;
}
 
Example #28
Source File: TaskStateManagerImplTest.java    From flink with Apache License 2.0 5 votes vote down vote up
public static TaskStateManager taskStateManager(
	JobID jobID,
	ExecutionAttemptID executionAttemptID,
	CheckpointResponder checkpointResponderMock,
	JobManagerTaskRestore jobManagerTaskRestore,
	TaskLocalStateStore localStateStore) {

	return new TaskStateManagerImpl(
		jobID,
		executionAttemptID,
		localStateStore,
		jobManagerTaskRestore,
		checkpointResponderMock);
}
 
Example #29
Source File: TaskDeploymentDescriptor.java    From flink with Apache License 2.0 5 votes vote down vote up
public TaskDeploymentDescriptor(
	JobID jobId,
	MaybeOffloaded<JobInformation> serializedJobInformation,
	MaybeOffloaded<TaskInformation> serializedTaskInformation,
	ExecutionAttemptID executionAttemptId,
	AllocationID allocationId,
	int subtaskIndex,
	int attemptNumber,
	int targetSlotNumber,
	@Nullable JobManagerTaskRestore taskRestore,
	Collection<ResultPartitionDeploymentDescriptor> resultPartitionDeploymentDescriptors,
	Collection<InputGateDeploymentDescriptor> inputGateDeploymentDescriptors) {

	this.jobId = Preconditions.checkNotNull(jobId);

	this.serializedJobInformation = Preconditions.checkNotNull(serializedJobInformation);
	this.serializedTaskInformation = Preconditions.checkNotNull(serializedTaskInformation);

	this.executionId = Preconditions.checkNotNull(executionAttemptId);
	this.allocationId = Preconditions.checkNotNull(allocationId);

	Preconditions.checkArgument(0 <= subtaskIndex, "The subtask index must be positive.");
	this.subtaskIndex = subtaskIndex;

	Preconditions.checkArgument(0 <= attemptNumber, "The attempt number must be positive.");
	this.attemptNumber = attemptNumber;

	Preconditions.checkArgument(0 <= targetSlotNumber, "The target slot number must be positive.");
	this.targetSlotNumber = targetSlotNumber;

	this.taskRestore = taskRestore;

	this.producedPartitions = Preconditions.checkNotNull(resultPartitionDeploymentDescriptors);
	this.inputGates = Preconditions.checkNotNull(inputGateDeploymentDescriptors);
}
 
Example #30
Source File: TaskStateManagerImplTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static TaskStateManager taskStateManager(
	JobID jobID,
	ExecutionAttemptID executionAttemptID,
	CheckpointResponder checkpointResponderMock,
	JobManagerTaskRestore jobManagerTaskRestore,
	TaskLocalStateStore localStateStore) {

	return new TaskStateManagerImpl(
		jobID,
		executionAttemptID,
		localStateStore,
		jobManagerTaskRestore,
		checkpointResponderMock);
}