Search in sources :

Example 46 with ExecutionAttemptID

use of org.apache.flink.runtime.executiongraph.ExecutionAttemptID in project flink by apache.

the class StackTraceSampleCoordinatorTest method testTriggerStackTraceSampleNotRunningTasks.

/** 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) };
    Future<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);
    }
}
Also used : ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) TriggerStackTraceSample(org.apache.flink.runtime.messages.StackTraceSampleMessages.TriggerStackTraceSample) ExecutionException(java.util.concurrent.ExecutionException) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) Test(org.junit.Test)

Example 47 with ExecutionAttemptID

use of org.apache.flink.runtime.executiongraph.ExecutionAttemptID in project flink by apache.

the class StackTraceSampleCoordinatorTest method testCollectStackTraceForCanceledSample.

/** 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) };
    Future<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[]>());
}
Also used : ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) TriggerStackTraceSample(org.apache.flink.runtime.messages.StackTraceSampleMessages.TriggerStackTraceSample) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) Test(org.junit.Test)

Example 48 with ExecutionAttemptID

use of org.apache.flink.runtime.executiongraph.ExecutionAttemptID in project flink by apache.

the class StackTraceSampleCoordinatorTest method testTriggerStackTraceSampleResetRunningTasks.

/** 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) };
    Future<StackTraceSample> sampleFuture = coord.triggerStackTraceSample(vertices, 1, Time.milliseconds(100L), 0);
    try {
        sampleFuture.get();
        fail("Expected exception.");
    } catch (ExecutionException e) {
        assertTrue(e.getCause() instanceof RuntimeException);
    }
}
Also used : ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) TriggerStackTraceSample(org.apache.flink.runtime.messages.StackTraceSampleMessages.TriggerStackTraceSample) ExecutionException(java.util.concurrent.ExecutionException) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) Test(org.junit.Test)

Example 49 with ExecutionAttemptID

use of org.apache.flink.runtime.executiongraph.ExecutionAttemptID in project flink by apache.

the class StackTraceSampleCoordinatorTest method testShutDown.

/** Tests that shut down fails all pending samples and future sample triggers. */
@Test
public void testShutDown() throws Exception {
    ExecutionVertex[] vertices = new ExecutionVertex[] { mockExecutionVertex(new ExecutionAttemptID(), ExecutionState.RUNNING, true) };
    List<Future<StackTraceSample>> sampleFutures = new ArrayList<>();
    // Trigger
    sampleFutures.add(coord.triggerStackTraceSample(vertices, 1, Time.milliseconds(100L), 0));
    sampleFutures.add(coord.triggerStackTraceSample(vertices, 1, Time.milliseconds(100L), 0));
    for (Future<StackTraceSample> future : sampleFutures) {
        assertFalse(future.isDone());
    }
    // Shut down
    coord.shutDown();
    // Verify all completed
    for (Future<StackTraceSample> future : sampleFutures) {
        assertTrue(future.isDone());
    }
    // Verify new trigger returns failed future
    Future<StackTraceSample> future = coord.triggerStackTraceSample(vertices, 1, Time.milliseconds(100L), 0);
    assertTrue(future.isDone());
    try {
        future.get();
        fail("Expected exception.");
    } catch (ExecutionException e) {
    // we expected an exception here :-)
    }
}
Also used : ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) ArrayList(java.util.ArrayList) TriggerStackTraceSample(org.apache.flink.runtime.messages.StackTraceSampleMessages.TriggerStackTraceSample) CompletableFuture(org.apache.flink.runtime.concurrent.CompletableFuture) Future(org.apache.flink.runtime.concurrent.Future) FlinkCompletableFuture(org.apache.flink.runtime.concurrent.impl.FlinkCompletableFuture) ExecutionException(java.util.concurrent.ExecutionException) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) Test(org.junit.Test)

Example 50 with ExecutionAttemptID

use of org.apache.flink.runtime.executiongraph.ExecutionAttemptID in project flink by apache.

the class StackTraceSampleCoordinatorTest method testCollectForDiscardedPendingSample.

/** 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) };
    Future<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[]>());
}
Also used : ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) TriggerStackTraceSample(org.apache.flink.runtime.messages.StackTraceSampleMessages.TriggerStackTraceSample) ExecutionVertex(org.apache.flink.runtime.executiongraph.ExecutionVertex) Test(org.junit.Test)

Aggregations

ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)81 Test (org.junit.Test)66 JobID (org.apache.flink.api.common.JobID)61 ExecutionVertex (org.apache.flink.runtime.executiongraph.ExecutionVertex)41 IOException (java.io.IOException)31 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)30 Configuration (org.apache.flink.configuration.Configuration)24 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)21 AcknowledgeCheckpoint (org.apache.flink.runtime.messages.checkpoint.AcknowledgeCheckpoint)19 ActorGateway (org.apache.flink.runtime.instance.ActorGateway)17 AkkaActorGateway (org.apache.flink.runtime.instance.AkkaActorGateway)16 TaskDeploymentDescriptor (org.apache.flink.runtime.deployment.TaskDeploymentDescriptor)15 TaskManagerServicesConfiguration (org.apache.flink.runtime.taskexecutor.TaskManagerServicesConfiguration)14 ActorRef (akka.actor.ActorRef)13 SubmitTask (org.apache.flink.runtime.messages.TaskMessages.SubmitTask)13 JavaTestKit (akka.testkit.JavaTestKit)12 BlobKey (org.apache.flink.runtime.blob.BlobKey)10 TriggerStackTraceSample (org.apache.flink.runtime.messages.StackTraceSampleMessages.TriggerStackTraceSample)10 PartitionNotFoundException (org.apache.flink.runtime.io.network.partition.PartitionNotFoundException)9 ResultPartitionID (org.apache.flink.runtime.io.network.partition.ResultPartitionID)9