Java Code Examples for org.apache.flink.runtime.execution.ExecutionState#SCHEDULED
The following examples show how to use
org.apache.flink.runtime.execution.ExecutionState#SCHEDULED .
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: RemoteChannelStateChecker.java From flink with Apache License 2.0 | 5 votes |
private boolean isProducerConsumerReady(ResponseHandle responseHandle) { ExecutionState producerState = getProducerState(responseHandle); return producerState == ExecutionState.SCHEDULED || producerState == ExecutionState.DEPLOYING || producerState == ExecutionState.RUNNING || producerState == ExecutionState.FINISHED; }
Example 2
Source File: RemoteChannelStateChecker.java From flink with Apache License 2.0 | 5 votes |
private boolean isProducerConsumerReady(ResponseHandle responseHandle) { ExecutionState producerState = getProducerState(responseHandle); return producerState == ExecutionState.SCHEDULED || producerState == ExecutionState.DEPLOYING || producerState == ExecutionState.RUNNING || producerState == ExecutionState.FINISHED; }
Example 3
Source File: Task.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
/** * Answer to a partition state check issued after a failed partition request. */ @VisibleForTesting void onPartitionStateUpdate( IntermediateDataSetID intermediateDataSetId, ResultPartitionID resultPartitionId, ExecutionState producerState) throws IOException, InterruptedException { if (executionState == ExecutionState.RUNNING) { final SingleInputGate inputGate = inputGatesById.get(intermediateDataSetId); if (inputGate != null) { if (producerState == ExecutionState.SCHEDULED || producerState == ExecutionState.DEPLOYING || producerState == ExecutionState.RUNNING || producerState == ExecutionState.FINISHED) { // Retrigger the partition request inputGate.retriggerPartitionRequest(resultPartitionId.getPartitionId()); } else if (producerState == ExecutionState.CANCELING || producerState == ExecutionState.CANCELED || producerState == ExecutionState.FAILED) { // The producing execution has been canceled or failed. We // don't need to re-trigger the request since it cannot // succeed. if (LOG.isDebugEnabled()) { LOG.debug("Cancelling task {} after the producer of partition {} with attempt ID {} has entered state {}.", taskNameWithSubtask, resultPartitionId.getPartitionId(), resultPartitionId.getProducerId(), producerState); } cancelExecution(); } else { // Any other execution state is unexpected. Currently, only // state CREATED is left out of the checked states. If we // see a producer in this state, something went wrong with // scheduling in topological order. String msg = String.format("Producer with attempt ID %s of partition %s in unexpected state %s.", resultPartitionId.getProducerId(), resultPartitionId.getPartitionId(), producerState); failExternally(new IllegalStateException(msg)); } } else { failExternally(new IllegalStateException("Received partition producer state for " + "unknown input gate " + intermediateDataSetId + ".")); } } else { LOG.debug("Task {} ignored a partition producer state notification, because it's not running.", taskNameWithSubtask); } }
Example 4
Source File: InputChannelDeploymentDescriptorTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
/** * Tests the deployment descriptors for local, remote, and unknown partition * locations (with lazy deployment allowed and all execution states for the * producers). */ @Test public void testMixedLocalRemoteUnknownDeployment() throws Exception { boolean allowLazyDeployment = true; ResourceID consumerResourceId = ResourceID.generate(); ExecutionVertex consumer = mock(ExecutionVertex.class); LogicalSlot consumerSlot = mockSlot(consumerResourceId); // Local and remote channel are only allowed for certain execution // states. for (ExecutionState state : ExecutionState.values()) { // Local partition ExecutionVertex localProducer = mockExecutionVertex(state, consumerResourceId); IntermediateResultPartition localPartition = mockPartition(localProducer); ResultPartitionID localPartitionId = new ResultPartitionID(localPartition.getPartitionId(), localProducer.getCurrentExecutionAttempt().getAttemptId()); ExecutionEdge localEdge = new ExecutionEdge(localPartition, consumer, 0); // Remote partition ExecutionVertex remoteProducer = mockExecutionVertex(state, ResourceID.generate()); // new resource ID IntermediateResultPartition remotePartition = mockPartition(remoteProducer); ResultPartitionID remotePartitionId = new ResultPartitionID(remotePartition.getPartitionId(), remoteProducer.getCurrentExecutionAttempt().getAttemptId()); ConnectionID remoteConnectionId = new ConnectionID(remoteProducer.getCurrentAssignedResource().getTaskManagerLocation(), 0); ExecutionEdge remoteEdge = new ExecutionEdge(remotePartition, consumer, 1); // Unknown partition ExecutionVertex unknownProducer = mockExecutionVertex(state, null); // no assigned resource IntermediateResultPartition unknownPartition = mockPartition(unknownProducer); ResultPartitionID unknownPartitionId = new ResultPartitionID(unknownPartition.getPartitionId(), unknownProducer.getCurrentExecutionAttempt().getAttemptId()); ExecutionEdge unknownEdge = new ExecutionEdge(unknownPartition, consumer, 2); InputChannelDeploymentDescriptor[] desc = InputChannelDeploymentDescriptor.fromEdges( new ExecutionEdge[]{localEdge, remoteEdge, unknownEdge}, consumerSlot.getTaskManagerLocation().getResourceID(), allowLazyDeployment); assertEquals(3, desc.length); // These states are allowed if (state == ExecutionState.RUNNING || state == ExecutionState.FINISHED || state == ExecutionState.SCHEDULED || state == ExecutionState.DEPLOYING) { // Create local or remote channels assertEquals(localPartitionId, desc[0].getConsumedPartitionId()); assertTrue(desc[0].getConsumedPartitionLocation().isLocal()); assertNull(desc[0].getConsumedPartitionLocation().getConnectionId()); assertEquals(remotePartitionId, desc[1].getConsumedPartitionId()); assertTrue(desc[1].getConsumedPartitionLocation().isRemote()); assertEquals(remoteConnectionId, desc[1].getConsumedPartitionLocation().getConnectionId()); } else { // Unknown (lazy deployment allowed) assertEquals(localPartitionId, desc[0].getConsumedPartitionId()); assertTrue(desc[0].getConsumedPartitionLocation().isUnknown()); assertNull(desc[0].getConsumedPartitionLocation().getConnectionId()); assertEquals(remotePartitionId, desc[1].getConsumedPartitionId()); assertTrue(desc[1].getConsumedPartitionLocation().isUnknown()); assertNull(desc[1].getConsumedPartitionLocation().getConnectionId()); } assertEquals(unknownPartitionId, desc[2].getConsumedPartitionId()); assertTrue(desc[2].getConsumedPartitionLocation().isUnknown()); assertNull(desc[2].getConsumedPartitionLocation().getConnectionId()); } }
Example 5
Source File: TaskDeploymentDescriptorFactory.java From flink with Apache License 2.0 | 4 votes |
private static boolean isProducerAvailable(ExecutionState producerState) { return producerState == ExecutionState.RUNNING || producerState == ExecutionState.FINISHED || producerState == ExecutionState.SCHEDULED || producerState == ExecutionState.DEPLOYING; }
Example 6
Source File: ShuffleDescriptorTest.java From flink with Apache License 2.0 | 4 votes |
/** * Tests the deployment descriptors for local, remote, and unknown partition * locations (with lazy deployment allowed and all execution states for the * producers). */ @Test public void testMixedLocalRemoteUnknownDeployment() throws Exception { ResourceID consumerResourceID = ResourceID.generate(); // Local and remote channel are only allowed for certain execution // states. for (ExecutionState state : ExecutionState.values()) { ResultPartitionID localPartitionId = new ResultPartitionID(); ResultPartitionDeploymentDescriptor localPartition = createResultPartitionDeploymentDescriptor(localPartitionId, consumerResourceID); ResultPartitionID remotePartitionId = new ResultPartitionID(); ResultPartitionDeploymentDescriptor remotePartition = createResultPartitionDeploymentDescriptor(remotePartitionId, ResourceID.generate()); ResultPartitionID unknownPartitionId = new ResultPartitionID(); ShuffleDescriptor localShuffleDescriptor = getConsumedPartitionShuffleDescriptor(localPartitionId, state, localPartition, true); ShuffleDescriptor remoteShuffleDescriptor = getConsumedPartitionShuffleDescriptor(remotePartitionId, state, remotePartition, true); ShuffleDescriptor unknownShuffleDescriptor = getConsumedPartitionShuffleDescriptor(unknownPartitionId, state, null, true); // These states are allowed if (state == ExecutionState.RUNNING || state == ExecutionState.FINISHED || state == ExecutionState.SCHEDULED || state == ExecutionState.DEPLOYING) { NettyShuffleDescriptor nettyShuffleDescriptor; // Create local or remote channels verifyShuffleDescriptor(localShuffleDescriptor, NettyShuffleDescriptor.class, false, localPartitionId); nettyShuffleDescriptor = (NettyShuffleDescriptor) localShuffleDescriptor; assertThat(nettyShuffleDescriptor.isLocalTo(consumerResourceID), is(true)); verifyShuffleDescriptor(remoteShuffleDescriptor, NettyShuffleDescriptor.class, false, remotePartitionId); nettyShuffleDescriptor = (NettyShuffleDescriptor) remoteShuffleDescriptor; assertThat(nettyShuffleDescriptor.isLocalTo(consumerResourceID), is(false)); assertThat(nettyShuffleDescriptor.getConnectionId(), is(STUB_CONNECTION_ID)); } else { // Unknown (lazy deployment allowed) verifyShuffleDescriptor(localShuffleDescriptor, UnknownShuffleDescriptor.class, true, localPartitionId); verifyShuffleDescriptor(remoteShuffleDescriptor, UnknownShuffleDescriptor.class, true, remotePartitionId); } verifyShuffleDescriptor(unknownShuffleDescriptor, UnknownShuffleDescriptor.class, true, unknownPartitionId); } }
Example 7
Source File: TaskDeploymentDescriptorFactory.java From flink with Apache License 2.0 | 4 votes |
private static boolean isProducerAvailable(ExecutionState producerState) { return producerState == ExecutionState.RUNNING || producerState == ExecutionState.FINISHED || producerState == ExecutionState.SCHEDULED || producerState == ExecutionState.DEPLOYING; }
Example 8
Source File: ShuffleDescriptorTest.java From flink with Apache License 2.0 | 4 votes |
/** * Tests the deployment descriptors for local, remote, and unknown partition * locations (with lazy deployment allowed and all execution states for the * producers). */ @Test public void testMixedLocalRemoteUnknownDeployment() throws Exception { ResourceID consumerResourceID = ResourceID.generate(); // Local and remote channel are only allowed for certain execution // states. for (ExecutionState state : ExecutionState.values()) { ResultPartitionID localPartitionId = new ResultPartitionID(); ResultPartitionDeploymentDescriptor localPartition = createResultPartitionDeploymentDescriptor(localPartitionId, consumerResourceID); ResultPartitionID remotePartitionId = new ResultPartitionID(); ResultPartitionDeploymentDescriptor remotePartition = createResultPartitionDeploymentDescriptor(remotePartitionId, ResourceID.generate()); ResultPartitionID unknownPartitionId = new ResultPartitionID(); ShuffleDescriptor localShuffleDescriptor = getConsumedPartitionShuffleDescriptor(localPartitionId, state, localPartition, true); ShuffleDescriptor remoteShuffleDescriptor = getConsumedPartitionShuffleDescriptor(remotePartitionId, state, remotePartition, true); ShuffleDescriptor unknownShuffleDescriptor = getConsumedPartitionShuffleDescriptor(unknownPartitionId, state, null, true); // These states are allowed if (state == ExecutionState.RUNNING || state == ExecutionState.FINISHED || state == ExecutionState.SCHEDULED || state == ExecutionState.DEPLOYING) { NettyShuffleDescriptor nettyShuffleDescriptor; // Create local or remote channels verifyShuffleDescriptor(localShuffleDescriptor, NettyShuffleDescriptor.class, false, localPartitionId); nettyShuffleDescriptor = (NettyShuffleDescriptor) localShuffleDescriptor; assertThat(nettyShuffleDescriptor.isLocalTo(consumerResourceID), is(true)); verifyShuffleDescriptor(remoteShuffleDescriptor, NettyShuffleDescriptor.class, false, remotePartitionId); nettyShuffleDescriptor = (NettyShuffleDescriptor) remoteShuffleDescriptor; assertThat(nettyShuffleDescriptor.isLocalTo(consumerResourceID), is(false)); assertThat(nettyShuffleDescriptor.getConnectionId(), is(STUB_CONNECTION_ID)); } else { // Unknown (lazy deployment allowed) verifyShuffleDescriptor(localShuffleDescriptor, UnknownShuffleDescriptor.class, true, localPartitionId); verifyShuffleDescriptor(remoteShuffleDescriptor, UnknownShuffleDescriptor.class, true, remotePartitionId); } verifyShuffleDescriptor(unknownShuffleDescriptor, UnknownShuffleDescriptor.class, true, unknownPartitionId); } }